PDA

View Full Version : toggle iframe url



spinningkrang
08-16-2010, 10:05 AM
Hi,

I can't seem to find an answer to this issue anywhere so I hope I can get some help here...

What i'm trying to do is to have an image or text toggle between 2 urls of an iframe.

So on the first click it will change the iframe url and on the second it will get back to the first url.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<title>Untitled Document</title>
</head>

<body>

<iframe name="iframe" src="http://www.google.com" style="width:400; height:400"></iframe>

<p>&nbsp;</p>
<p class="style1"><span style="color: #0000FF;font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold;"><a href="http://maps.google.com/" target="iframe">click</a></span></p>
</body>
</html>




Thank you!

Beverleyh
08-16-2010, 06:27 PM
Rather than toggle the iframe src it will probably be easier to have both iframes present on the page at load time but then toggle visibility between the two so only one appears to the user at any one time.

Check out jQuery and hide() and show() http://jquery.com/