Ok, here we go...
I have been trying this problem for a while now and with no solution. Perhaps the smartest of the smart can help with this problem.
A simple drop down menu.... Check it out...
Yes I did that menu! (WOW, I can copy and paste a script)
Now, the problem happens when you have 100+ pages to update and the categories on the dropdown menu are changing daily.
I was wondering how to update a centrall file, such as a .js file and have it update all the pages automaticly.
BUT WAIT THERES MORE>>>>>
Many sugguest using an external file...
such as...
<script src="/buildmenu.js"
type="text/javascript"
language="Javascript1.1">
<!--
build_menu();
// -->
</script>
BUT...
the problem happens when the build menu function is called.
If you think about the structure of the simple dropdown menu you will see 2 parts...
The part that is java...
<script language="JavaScript">
function surfto(form) {
var myindex=form.dest.selectedIndex
location=form.dest.options[myindex].value;
}
//-->
</SCRIPT>
and the part that is a form...
</SCRIPT>
<FORM NAME="myform">
<SELECT NAME="dest" SIZE=1>
<OPTION SELECTED VALUE="http://URL#1">URL #1 DESCRIPTION
<OPTION VALUE="http://URL#2">URL #2 DESCRIPTION
<OPTION VALUE="http://URL#3">URL #3 DESCRIPTION
<OPTION VALUE="http://URL#4">URL#4 DESCRIPTION
</SELECT>
<INPUT TYPE="BUTTON" VALUE="GO NOW!" onClick="surfto(this.form)">
</FORM>
Now we all know (or at least i think i know.) that you CANT HAVE A FORM IN A .js file.
So...
Referring to an external .js file wouldnt work.
But wait theres even more!!!
A good friend of mine sugguestd a code like this...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled</title>
<script type="text/javascript" language="Javascript1.1">
<!--
function build_menu() {
document.writeln('<select name="mymenu">');
document.writeln('<option value="index.html">Home<' + '/option>');
document.writeln('<option value="other.html">Elsewhere<' + '/option>');
document.writeln('<' + '/select>');
}
//-->
</script>
</head>
<body>
<form action="foo.pl" method="get">
<script type="text/javascript" language="Javascript1.1">
<!--
build_menu();
// -->
</script>
</form>
</body>
</html>
It works fine in IE but...
when i link to it or referrer to the java in a .js file that looks like this...
<!--
function build_menu() {
document.writeln('<select name="mymenu">');
document.writeln('<option value="index.html">Home<' + '/option>');
document.writeln('<option value="other.html">Elsewhere<' + '/option>');
document.writeln('<' + '/select>');
}
//-->
... and referr to it like this...
<script src="/buildmenu.js"
type="text/javascript"
language="Javascript1.1">
<!--
build_menu();
// -->
</script>
It doesnt do anything... I get a blank screen.
If you have read to here perhaps you understand my delema... Soo simple but yet i cant seem to get it. Any help or sugguestions you supply would be of great help... 5 bucks for the winner..
Yours truely,
Steven
I have been trying this problem for a while now and with no solution. Perhaps the smartest of the smart can help with this problem.
A simple drop down menu.... Check it out...
Yes I did that menu! (WOW, I can copy and paste a script)
Now, the problem happens when you have 100+ pages to update and the categories on the dropdown menu are changing daily.
I was wondering how to update a centrall file, such as a .js file and have it update all the pages automaticly.
BUT WAIT THERES MORE>>>>>
Many sugguest using an external file...
such as...
<script src="/buildmenu.js"
type="text/javascript"
language="Javascript1.1">
<!--
build_menu();
// -->
</script>
BUT...
the problem happens when the build menu function is called.
If you think about the structure of the simple dropdown menu you will see 2 parts...
The part that is java...
<script language="JavaScript">
function surfto(form) {
var myindex=form.dest.selectedIndex
location=form.dest.options[myindex].value;
}
//-->
</SCRIPT>
and the part that is a form...
</SCRIPT>
<FORM NAME="myform">
<SELECT NAME="dest" SIZE=1>
<OPTION SELECTED VALUE="http://URL#1">URL #1 DESCRIPTION
<OPTION VALUE="http://URL#2">URL #2 DESCRIPTION
<OPTION VALUE="http://URL#3">URL #3 DESCRIPTION
<OPTION VALUE="http://URL#4">URL#4 DESCRIPTION
</SELECT>
<INPUT TYPE="BUTTON" VALUE="GO NOW!" onClick="surfto(this.form)">
</FORM>
Now we all know (or at least i think i know.) that you CANT HAVE A FORM IN A .js file.
So...
Referring to an external .js file wouldnt work.
But wait theres even more!!!
A good friend of mine sugguestd a code like this...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled</title>
<script type="text/javascript" language="Javascript1.1">
<!--
function build_menu() {
document.writeln('<select name="mymenu">');
document.writeln('<option value="index.html">Home<' + '/option>');
document.writeln('<option value="other.html">Elsewhere<' + '/option>');
document.writeln('<' + '/select>');
}
//-->
</script>
</head>
<body>
<form action="foo.pl" method="get">
<script type="text/javascript" language="Javascript1.1">
<!--
build_menu();
// -->
</script>
</form>
</body>
</html>
It works fine in IE but...
when i link to it or referrer to the java in a .js file that looks like this...
<!--
function build_menu() {
document.writeln('<select name="mymenu">');
document.writeln('<option value="index.html">Home<' + '/option>');
document.writeln('<option value="other.html">Elsewhere<' + '/option>');
document.writeln('<' + '/select>');
}
//-->
... and referr to it like this...
<script src="/buildmenu.js"
type="text/javascript"
language="Javascript1.1">
<!--
build_menu();
// -->
</script>
It doesnt do anything... I get a blank screen.
If you have read to here perhaps you understand my delema... Soo simple but yet i cant seem to get it. Any help or sugguestions you supply would be of great help... 5 bucks for the winner..

Yours truely,
Steven
Comment