Using a variable for always the same url in Links

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
tku
Beginner
Beginner
Posts: 1
Joined: Fri Oct 03, 2003 12:25 pm

Using a variable for always the same url in Links

Post by tku »

Hi

I'm not quite good in JS, so I need a little help.

I am using the menu and most of the menu items are linking to another domain like http://www.xyz.com/<different sites>.

Currently, I am writing this url hard-coded in each menu link, but I would prefer to write it in a JavaScript variable in one of the first lines and use it then

<a href="variable+\"/site1.htm\" "

or similar.

As you see, I don't even know in which of the both files I have to declare the variable und also not the correct syntax to use this variable in the links.

Maybe someone can help me ?? :oops: :?:

Thanks in advance
Thomas
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

You need to set the variable in the top of your menu_data file. Something like...



var urlString = "www.something.com";





and then in your menu item code you need to swap this in...I am fading on the v3 syntax but it might be somethng like....



,,,"","",,,"http://" + urlString + "/somepage.html","","",,,,,"",1



Essentially you need to take the String where you were declaring your url cut out a chunk of it and put in " + var + ". Get what I am saying. Sorry I am so vague, I pulled an all nighter last night, got a project due friday at midnight so I am alittle out of it. 8O
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply