Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:07
Using a variable for always the same url in Links
Poster: tku
Dated: Friday October 3 2003 - 12:32:08 BST
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 ??
Thanks in advance
Thomas
Poster: Hergio
Dated: Friday October 3 2003 - 19:44:20 BST
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.