Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: change source of iframe from my combo box. How?


Message #1 by Tristian O'brien <obrient@m...> on Tue, 12 Sep 2000 11:37:52 +0100
My solution to you problem is as follows:

If you want the location to change after the submit button is clicked, then 
write an OnClick event for the Submit button and call a JavaScript function
from that event.
Then, in that function type this code:

document.pres.location = "xxxxx.html";

But you won't see anything unless the form loads the current page again.

OR if you want the location to change when the page is loading, you can put
onLoad function in the <body> tag. And write the same statement above.  This
will change the source of the iframe dynamically.


-----Original Message-----
From: Tristian O'brien [mailto:obrient@m...]
Sent: Tuesday, September 12, 2000 6:38 AM
To: javascript
Subject: [javascript] change source of iframe from my combo box. How?


my iframe is called 'pres' and i wanna change its source.  i would use ASP,
but this is for a cd so its gotta be client scripted!!

many thanks..
Tristian O'Brien

Webmaster
Newmark Ltd.
############################################################################
###################################################################
<html>
<head>
<SCRIPT language="Javascript">
function swapFrame(option)
{
//window.self.location = option
parent.frames[0].src = option
}

</SCRIPT>
</head>

<body 

      <form name="QuickIndex">
        <div class="cbo1"> 
          <select size=1 name="URL"
onChange="if(options[selectedIndex].value)
swapFrame(options[selectedIndex].value)">
            <option selected>Select Presentation</option>
            <option value="01.htm">Industry Leader Address </option>
            <option>---- XS HEALTH</option>
          </select>
          <noscript> 
          <input type=submit value="Go" name="submit">
          </noscript> </div></form>
    </td>
  </tr>

</table>
<IFRAME name="pres" src="01Matthew Mills.htm" width='100%' height='92%'>

</IFRAME>

---<BR>
You are currently subscribed to javascript as: eersoy@s...<BR>
</BODY>
</html>
############################################################################
###################################################################




  Return to Index