|
Changing Multiple Frames in One Step
| [Previous] [Main] [Next] |
|
| |
| Normally, a hyperlink can update the content of a single frame using htmlHyperLink::Target(). However, it is possible to create a link that updates multiple frames at one time by using the ONCLICK attribute of a hyperlink to invoke JavaScript code that changes the source (location) of the frames.
| |
|
| |
| // Create a string containing the JavaScript code
| |
| String javascript ;
| |
| javascript << "top.frames[2].location='frform1.htm';"
| |
| "return true;" ;
| |
|
| |
| // Create a hyperlink object, setting it's targer
| |
| // window and the JavaScript ONCLICK attribute to
| |
| // our code.
| |
| htmlHyperLink h( "formtoc.htm", "Click here" ) ;
| |
| h.Target( "toptoc" )
| |
| .SetAttribute( "onClick", javascript ) ;
| |
|
| |
|
| |
| <A HREF="formtoc.htm" TARGET="toptoc" onClick="top.frames[2].location='frform1.htm';return true;">Click here</A>
| |
|
| |
