I’ve been trying to develope a javascript menu that will work with mac’s new Safari broswser. My menu system works great for most things, but i’m having trouble understanding one thing.
I’m using a script that lets me create menu items with a addMenuItem comand, to which I pass the name of the item, and its location….sort of like menu.addMenuItem(“Test”, “www.google.com”); would make a menu item that said “Test” and when clicked went to Google. So far so good.
I needed now to create a frame below the menu where I could display selected links. I created a frame called bottomFrame for this. Its just a blank html file.
Now I found I could pass something like
menu.addMenuItem(“Test”, “bottomFrame.location.href=’www.google.com'”); no problem.
Variations like
bottomFrame.location and parent.bottomFrame.location have the same effect. (Anyone want to explain to me the difference between those 3? I understand what they are doing, but not sure I understand the differences if any)
Now the problem I’m having is that if I try to link .gif’s the same way, after the first one loads no others will. These .gif’s are all stored in an Images folder in the site root folder. When linking them I’d use something like
(“Test”, “bottomFrame.location.href=’images/image1.gif'”);
And they always load….or at least the first one will. As soon as one .gif loads in bottomFrame I cannot get it to switch to another. My best guess is that it is because the .gif isn’t really being opened inside of that frame, but rather is replacing it in some way….therefore the other links targeting bottomFrame no longer have a valid target.
It kills me tho because if i just create a few links using <a href=”Images/image1.gif” target=”bottomFrame”>Text</a>
I can switch between the .gif’s at will and have them load in the bottomFrame.
Why is there a difference between using <a href='”target=””) and passing a line to a jscript that says bottomFrame.location.href=”” or somethign simliar? I mean it seems like both are saying to set the bottomFrame to display the location that gets passed, so what gives? I tried to pass <a href> instead of the other thigns, but that wouldn’t work at all. Considering I dont know a whole lot about html/javascript I’ll be lucky if this means anything at all to anyone. But its worth a shot : )