Linking: file then javascript

J

Jarry

A simple question: I want to load a page from a link, then tell that
page (the one that just loaded) to do a javascript function. For
example, the page test.html has a function called showalert(), and I
want an <a> type link that loads the page, then shows the alert. How
can I do this?

Thanks,
Jarry
 
L

Lee

Jarry said:
A simple question: I want to load a page from a link, then tell that
page (the one that just loaded) to do a javascript function. For
example, the page test.html has a function called showalert(), and I
want an <a> type link that loads the page, then shows the alert. How
can I do this?

You can't. Once the new page loads, the old page is gone, and so
can't tell the new one anything. One work-around would be to load
the new page in a frame, so the old page is still actually there
(invisibly, if you like), but it would be more reasonable to write
the second page so that it knows when to execute showalert() based
on something like the referrer page or values in the search part
of the URL, or cookies.


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top