faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

32 of 53 people (60%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

how do i target the specified frame using javascript

Apr 4th, 2008 20:58
ha mo, Colin Fraser, chin min,


It depends on  what point you want to reference the frames. If you are 
loading the complete frameset from start, then you could do this: 
<frameset onLoad="frames[1].location.href= 
                  'http://www.whatever.com.au'">
    <frame src="pageA.html">
    <frame src="pageB.html">
</frameset>
You can use the frameset onload method  
Alternatively, you could use the BODY onLoad event handler: 
<BODY onLoad="parent.frames[1].location.href= 
                 'http://www.whatever.com.au'">
Another alternative could be the onClick event
<a href="javascript:void" onClick="parent.frames[1].location.href=      
                 'http://www.whatever.com.au'"><img src="pic.gif"></a>
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com