Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load a frame onClick

Status
Not open for further replies.

marcela24

Programmer
Feb 17, 2003
72
NL
I want to use the event onClick to load a frame in my webpage. Do I have to call a function in the event to do that or is there a way to do it without using a function?
And how can i do that?

Thank you for helping me,
Marcela
 
No you dont have to make a function but if you want your code to make more sence to people reading it then you should and also if you wanted to make it disapear then a finction would be easiest.
try something like

give the frame a name like "Frame1"
then maybe

<input type=&quot;button&quot; onClick=&quot;frame1.visibility=visible&quot;>
but that might not do exactly what you want

But with that you will have to set the visibility on the frames to hidden
 
Hi Marcela,

I'm presuming you already have a frameset document, and that each pane of the document already has a name (say, Pane01, Pane02, Pane03, etc.).

In that case, a typical URL would refer to that target window:

Code:
<a href=&quot;goober.html&quot; target=&quot;Pane02&quot;>Click me!</a>

(If there is no existing Pane02, the browser usually pops a new window and names it &quot;Pane02&quot;.)

Now, doing that with a button isn't a whole lot different.

Try

Code:
<!DOCTYPE html 
     PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
     &quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/URL]

<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;[/URL] xml:lang=&quot;en&quot; lang=&quot;en&quot;>
  <head>
    <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;></meta>
    <title>JavaScript Sample</title>
  </head>
  <body>
    <p>Press the button to visit Google:</p>
    <input type=&quot;button&quot; value=&quot;Google Me!&quot; onclick=&quot;parent.location='[URL unfurl="true"]http://www.google.com'&quot;></input>[/URL]
  </body>
</html>

Changing
Code:
parent.location
to whatever you need, of course. No functions!

Good luck!
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top