Solved

OnLoad

Posted on 2000-03-06
2
679 Views
Last Modified: 2012-05-04
Whats the syntax for the OnLoad handler.
I want to load a page into another target frame, and pass it a query string.
Also how do you do this with framesets
0
Comment
Question by:rickyr
2 Comments
 

Accepted Solution

by:
yes4me earned 33 total points
ID: 2589093
First you got your main frame... something like (this is the very simplify version of what I will write):


<HTML><frameset rows="200%,*">
<frame src="first_frame.html" name="first_frame">
<frame src="second_frame.html" name="second_frame">

</frameset>
<noframes>
Whatever you want here to display if the user doesn't have frame
</noframes>
</BODY></HTML>



Then you got your first frame with the following code:

<HTML><BODY>
<a href="some_html.html" TARGET="second_frame"
</BODY></HTML>


Clicking on the link of the first frame will load a page into the second frame.



Now to pass the query string to the next frame, you need to use something completly different. You need to use cookies... and that's tough if you are not use to it. Well you need first to set the cookie... something like:

function setCookie()
{

      var
the_name = prompt("What's your name?","");

      var the_cookie =
"wm_javascript=username:" + escape(the_name);

      document.cookie =
the_cookie;

      alert("Thanks, now go to the next
page.");

}

and retrieve it later on using:

function readCookie()
{

      var
the_cookie = document.cookie;

      var broken_cookie =
the_cookie.split(":");

      var the_name = broken_cookie[1];

      var
the_name = unescape(the_name);

      alert("Your name is: " +
the_name);

}


Of course, you need to place there function inside some javascript comments: <SCRIPT>... code here... </SCRIPT>
0
 
LVL 3

Author Comment

by:rickyr
ID: 2623261
Ta
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now