Home All Groups Group Topic Archive Search About

Is there a better way then iframe?

Author
25 Jul 2006 4:05 PM
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>

Author
25 Jul 2006 4:14 PM
Patrice
You could do this à la AJAX. See http://en.wikipedia.org/wiki/AJAX and in
particular http://en.wikipedia.org/wiki/XMLHttpRequest

--
Patrice

"Brian D" <bdalti***@yahoo.com> a écrit dans le message de news:
1153843558.219344.149***@p79g2000cwp.googlegroups.com...
Show quoteHide quote
> 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>
>
Are all your drivers up to date? click for free checkup

Author
25 Jul 2006 4:30 PM
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>
Author
25 Jul 2006 6:15 PM
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

--

Patrice

"Brian D" <bdalti***@yahoo.com> a écrit dans le message de news:
1153845003.999209.73***@h48g2000cwc.googlegroups.com...
Show quoteHide quote
> 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>
>

Bookmark and Share

Post Thread options