Forum Moderators: not2easy
For example:
If someone comes in from FRONT1.htm I want MAIN.htm to have red.css
If someone comes in from FRONT2.htm i want MAIN.htm to have blue.css
Any relevant links on this subject, course code..etc
would be very helpful. thank you
File1.htm...
...
<script type="text/javascript">
<!--
function loadCSS(file, css) {
window.location.href = file + '?' + css;
}
//-->
</script>
</head>
...
<a href="File2.htm" onclick="loadCSS(this.href, 'blue.css'); return false;">Blue</a>
<a href="File2.htm" onclick="loadCSS(this.href, 'red.css'); return false;">Red</a>
File2.htm...
...
<script type="text/javascript">
<!--
if (window.location.search) {
var css = window.location.search.substring(1);
document.write("<link type=\"text/css\" rel=\"stylesheet\" href='" + css + "'/>");
}
//-->
</script>
</head>
...
<div>
This is some text...
</div>
--------
To change the stylesheet on page 2 based on where a person came from, do something like...
File2.htm...
...
<script type="text/javascript">
<!--
if (document.referrer) {
var css = null;
if (document.referrer.search(/File1\.htm/i)!= -1) {
css = "red.css";
}
if (document.referrer.search(/File3\.htm/i)!= -1) {
css = "blue.css";
}
document.write("<link type=\"text/css\" rel=\"stylesheet\" href='" + css + "'/>");
}
//-->
</script>
</head>
...
<div>
This is some text...
</div>
HTH
Jordan