change 2 iframe with one click?

liunx

Guest
hi there, i was wondering if anyone can help me with my problem.<br />
<br />
I have a page which consists of a table that has 2 iframes in it. My question is if there is anyway in which clicking on a link within the table (not in iframe) can possibly change the content of both iframes at the same time. If not, are there any simple javascript codes that can do this?<br />
<br />
I thank you for your help.<br />
(if this message has appeared twice I apologize)<!--content-->This is how you can do that.<br />
1. create a link<br />
< ahref=http://www.webdeveloper.com/forum/archive/index.php/"javascript:Process()"> Change IFrames</a><br />
<br />
2. Suppose both of your iframes has name attributes<br />
<iframe name="iframe_1" src=http://www.webdeveloper.com/forum/archive/index.php/"xx.html"><br />
<br />
<iframe name="iframe_2" src=http://www.webdeveloper.com/forum/archive/index.php/"xx.html"><br />
<br />
3. In the javascript code sction define the Process() function which we intend to call when the link above is clicked.<br />
<br />
4. function deffinition<br />
<br />
function Process(){<br />
//we want to access both Iframes<br />
parent.iframe_1.document.formName.elementName.value=""<br />
parent.iframe_2.document.formName.elementName.value=""<br />
//above lines how how to access form fields and change their values in both iframes at same time<br />
}<!--content--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"<br />
"http://www.w3.org/TR/html4/strict.dtd"><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<title>IFRAME example</title><br />
<br />
<p>But JavaScript fails for one in ten users. If we were talking here about old fashioned frames then I would suggest multiple frame sets but that's not practical with inline frames. The solution is to use JavaScript to draw the JavaScript dependent links and to use the NOSCRIPT element to present the two links necessary for the JavaScript free.</p><br />
<br />
<iframe src=http://www.webdeveloper.com/forum/archive/index.php/"http://www.w3c.org/" name="one"><a href="http://www.w3c.org/">W3C</a></iframe><br />
<br />
<iframe src=http://www.webdeveloper.com/forum/archive/index.php/"http://www.w3c.org/" name="two"><a href="http://www.w3c.org/">W3C</a></iframe><br />
<br />
<div><br />
<script type="text/javascript"><br />
<!--<br />
document.write('<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">Change IFRAMEs</a>');<br />
document.links[document.links.length-1].onclick = function () {<br />
document.frames.one.location="http://www.w3.org/TR/REC-html32";<br />
document.frames.two.location="http://www.w3.org/TR/html4/";<br />
return false;<br />
}<br />
// --><br />
</script><br />
<noscript><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"http://www.w3.org/TR/REC-html32" target="one">3.2</a><br><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"http://www.w3.org/TR/html4/" target="two">4.01</a><br />
</noscript><br />
</div><!--content-->hey guys thanks for the help. I really appreciate it. <br />
<br />
Still, a slight problem remains. The problem is that, for the 2 inline frames to be updated, I would like to use a "Submit" button that would change these items in question. The code works extremely well using <a href> links but I can't get it to work using a form button..argh! Anyway, I'd be very grateful for help on this matter again. And thanks for the javascript code...I'm trying to think of many ways to put it to good use :D<!--content-->
 
Back
Top