Forum Moderators: open

Message Too Old, No Replies

loading a page then executing a script with one line

javascript

         

sarsonuk

4:31 am on Mar 26, 2004 (gmt 0)

10+ Year 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 [geocities.com...] and select america/sugarloaf

Can anyone help
Thanks in advance
Pete

Rambo Tribble

5:04 am on Mar 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unfortunately, the page was down when I went to view it. Adding to your troubles is the fact the moderator will likely remove your URL, as it appears to violate the site's TOS.

I don't know that it will have any affect, but the "javascript:" pseudo-URL probably doesn't belong in this code. It should only appear as part of the value of an href value in a link, as in <a href="javascript:myFunction();">link text</a>

I'm afraid I don't get your description of the location of the code vis-a-vis the parent/child relationship, nor your description of the sequence of events. Could you explain it step by step? Also, while the standard for this forum is to post just the code in question, I'm not sure there is quite enough to go on here.

sarsonuk

5:35 am on Mar 26, 2004 (gmt 0)

10+ Year Member



The setslide function that you can see sets an array index loaded with paths to images.
I want to use a menu on another page to call one page then execute the setslide(num) function i.e. I'm independantly controlling the num variable from outside the script so that I can play multiple slideshows in one html file.
If there is anyway of doing this I would much appreciate the information.

Thanks inadvance
Pete