PDA

View Full Version : Calling javascript on different page



sylver
07-19-2007, 01:36 PM
How can i call javascript function on page from link on different page?

Tnx

brentnicholas
07-19-2007, 08:14 PM
From what I understand, the function you want to call needs to be a child (spawned from the page with the function on it) of the calling page.

Then I think you do: parent.functionName();

GreenZombie178
07-19-2007, 09:13 PM
you could try cutting and pasting all of your functions and variables into one external .js file, and adding <script src="filename.js"></script> into the head of every page, that way you can access any script on your whole website on every page

sylver
07-19-2007, 11:35 PM
Sorry i did not explained very well what i want to do.

For example, i have page1 i page2.php. On the 2nd page i have div container which i use for loading external pages by calling a simple function javascript:page(3) . In this case this function loads some 3rd page.

When i click on some link on page1.php i want to open page2.php with loaded 3rd page into div container.

That is my problem.How can i call function on page2.php from simple link on page1.php. Btw function is in external .js file.

Tnx again