FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » HTML, Javascript, jQuery & AJAX » loading a page and executing a script local to it
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
loading a page and executing a script local to it [message #17332] Fri, 26 March 2004 04:03 Go to next message
sarsonuk is currently offline  sarsonuk   United States
Messages: 1
Registered: March 2004
Location: UK
Karma: 0
Junior Member

I'm trying to execute a string that will load a page and execute a script local to that page from a menu item in a frame.
The first part of the code works i.e. it loads the page no problem but I cannot get the function to execute when the page loads.
The code I am using is:-
javascript:parent.mainFrame.location.href='./america_ss.html';javascript:pa rent.mainFrame.setslide(3)

I am worried that the reason the function is not executing is because the .js file hasn't loaded in time before the function is executed.

The page can be seen that I am trying to interface at http://www.geocities.com/sarsonuk/travel.html and select america/sugarloaf

Can anyone help
Thanks in advance
Pete
Re: loading a page and executing a script local to it [message #17848 is a reply to message #17332] Thu, 22 April 2004 12:46 Go to previous message
lahoo is currently offline  lahoo   Sweden
Messages: 62
Registered: April 2004
Karma: 0
Member
You could pass the name of the function to call as a parameter to the page you intend to load and then have logic in the body's onload()-method to execute that function.

The general solution would eb something like this.
javascript:parent.mainFrame.location.href='./america_ss.html?setslide(3)'

and in america_ss.html
<body onload="eval(location.search.substr(1))">

Please note that the code above is just an outline. I didn't mind adding error handling or anything else.
  Switch to threaded view of this topic Create a new topic Submit Reply
Next Topic: Select Avatar Problems
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 09:01:52 GMT 2024

Total time taken to generate the page: 0.02077 seconds