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?

18 of 34 people (53%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

how do i target the specified frame using javascript

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


Firstly, try using variables to navigate between frames eg.

var varName = parent.frameName.objectName.propertyName;

so we have frameset like : 

 <FRAMESET ROWS="50%,50%">
     <FRAME SRC="frame1.htm" NAME="frame1">
     <FRAME SRC="frame2.htm" NAME="frame2">
 </FRAMESET>

If frame2 contains what we want to look at, then we can put into frame1 
: 

 <HTML>
 <HEAD>
 <SCRIPT LANGUAGE="JavaScript"><!--
 function loadForm() {
     document.frame2detail.a.value = parent.frame2.location.href;
     document.frame2detail.b.value = parent.frame2.document.title;
     document.frame2detail.c.value = parent.frame2.document.referrer;
 }
 //--></SCRIPT>
 </HEAD>

 <BODY>
 <H1>frame2 details</H1>

<FORM NAME="frame2detail">
 <INPUT TYPE="BUTTON" VALUE="Examine" onClick="loadForm()">
<TABLE>

<TR><TD>
href</TD><TD><INPUT TYPE="TEXTBOX" NAME="a" VALUE="" size=40></TD></TR>

<TR><TD>title </TD><TD><INPUT TYPE="TEXTBOX" NAME="b" VALUE="" 
size=40></TD></TR>

 <TR><TD>referrer</TD><TD><INPUT TYPE="TEXTBOX" NAME="c" VALUE="" 
size=40></TD></TR>

 </TABLE>
 </FORM>

 <P>

 </BODY>
 </HTML>

I think this the sort of thing that you are after.



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