Hi all
I have done lots of VB programming, but am not familiar with JavaScript.
Can anyone tell me how to do this ....?
I have a JS file for a menu system called menu.js
It contains the following function :
this.jumpURL = function(url) {
if(url) document.locati on.href = url;
}
I want to get the function to select the 'target' frame / page / etc
depending on variables sent to the function.
eg
this.jumpURL = function(url, target) {
if(url) target.location .href = url;
If I then call the function jumpURL (www.abcd.com, InFrame1 )
it should open the page in an inline frame named InFrame1
For some reason I cannot grasp how to make this work.
However, if I change it to :
if(url) InFrame1.locati on.href = url;
it works fine ( ie.. with the physical name of the frame in the statement ).
SO.......How can I use a variable in place of "InFrame1" ?
or do I need something along the lines of :
if target = "InFrame1" then if(url) InFrame1.locati on.href = url;
if target = "InFrame2" then if(url) InFrame2.locati on.href = url;
if target = "InFrame3" then if(url) InFrame3.locati on.href = url;
This would be the VB style of IF statement - I do not understand the JS
structure yet.
However, this would be very limiting meaning that I would need to modify the
function in the menu.js file every time my html page was changed.
My thanks and appreciation in advance for any assistance.
DaveO