Is there a better way then iframe?

B

Brian D

There has got to be a better way to do this instead of using the iframe
tag. I am looking for a solution that doesn't reload the entire page.
There will much more than the select tag on the initial page.

When it is in production, getimage.asp will have a DB lookup to
determine the file name and imageID will actually be a number (not the
filename).

Also it doesn't seem to work in Firefox.

Thanks
Brian

------------------------------------

<html>
<head>
<title>Image Test</title>
<script language="JavaScript">
function getImageList()
{
imageID =
document.form1.imageID.options[document.form1.imageID.selectedIndex].value;
document.frmRemote.location = "getImage.asp?imageID="+imageID
}
</script>
</head>
<body>
<table height=10>
<tr>
<td>
<form name="form1">
<select name="imageID" size="1" style="width:135px;"
onChange="getImageList();">
<option value="">Image ...</option>
<option value="external.jpg">1</option>
<option value="getacro.gif">2</option>
<option value="go.gif">3</option>
</select>
</form>
</td>
<td>
<iframe name="frmRemote" scrolling="no" id="frmRemote"
height="25"></iframe>
</td
</tr>
</table>
</body>
</html>

[getImage.asp]
<%@ Language=VBScript %>
<%imageID = trim(Request("imageID"))%>
<html>
<head>
</head>
<body leftmargin="0" topmargin="0">
<%if not imageID = "" then%>
<img src="/images/<%=imageID%>"></img>
<%end if%>
</body>
</html>
 
B

Brian D

Patrice,

Thanks for the quick response. I should have thought about it for 5
more minutes though. This is what I came up with instead:

<html>
<head>
<title>Image Test</title>
<script language="JavaScript">
function getImageList()
{
if (!document.images)
return
document.images.image.src='/images/'+document.form1.imageID.options[document.form1.imageID.selectedIndex].value
}
</script>
</head>
<body>
<form name="form1">
<table>
<tr>
<td>
<select name="imageID" size="1" style="width:135px;"
onChange="getImageList();">
<option value="" selected>Image ...</option>
<option value="external.jpg">1</option>
<option value="getacro.gif">2</option>
<option value="go.gif">3</option>
</select>
</td>
<td>
<img src="/images/space.gif" name="image"></img>
</td>
</tr>
</table>
</form>
</body>
</html>
 
P

Patrice

Great it's solved.

Next time, please be explicit about the exact problem you are trying to
solve (my understanding was that you wanted later to refresh a whole lot of
things, not just an image, I understand now that you wanted to refresh just
the image, saying that you want to refresh the image because you'll have
much more information on the page later (those information won't be
refreshed)).

TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top