Send an HTML variable to script

G

Gnarlodious

I want to send a variable to a styleswitching script that will be a function
of where the script is in the folder structure.

The script will then assemble the stylesheet URL around the variable.
For example, the variable "../../../../" would need to be sent to the
script, how will I do this?

Here is the script:
http://www.Spectrumology.com/Styles/switcher.js

And here is how I call it:
<script type="text/javascript" src="Styles/switcher.js"></script>

Sorry I don't know a thing about Javascript!

-- Gnarlie
http://www.Gnarlodious.com/Cogent/Cogent.html
 
G

Grant Wagner

Gnarlodious said:
I want to send a variable to a styleswitching script that will be a function
of where the script is in the folder structure.

The script will then assemble the stylesheet URL around the variable.
For example, the variable "../../../../" would need to be sent to the
script, how will I do this?

Here is the script:
http://www.Spectrumology.com/Styles/switcher.js

And here is how I call it:
<script type="text/javascript" src="Styles/switcher.js"></script>

Sorry I don't know a thing about Javascript!

-- Gnarlie
http://www.Gnarlodious.com/Cogent/Cogent.html

<script type="text/javascript">
window.thePath = "../../../../";
</script>
<script src="Styles/switcher.js"></script>

In switcher.js you'd have something like:

var myPath = window.thePath;

and you'd substitute myPath wherever you want your specific path.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,082
Messages
2,570,586
Members
47,209
Latest member
Ingeborg61

Latest Threads

Top