Forum Moderators: open
<FORM>
<SELECT>
<OPTION VALUE="pics/page1.html">Page 1
<OPTION VALUE="pics/page2.html">Page 2
<OPTION VALUE="pics/page3.html">Page 3
</SELECT>
<INPUT TYPE="button" VALUE="Go" onClick="jumpBox(this.form.elements[0])">
</FORM>
Now...how would I correctly use <noscript> so a list of text links appear if the browser doesn't support javascript? I tried just putting the <noscript> after the form end tag, but the jump box still displays on Mozilla even when I turn javascript off....the jump box won't work though of course. I experimented with enclosing the form in a <script> tag, but that won't work either. Any help appreciated.
Well, <noscript> is used to display alternative content in browsers that either don't support JavaScript or have it turned off.
For example:
<script type="text/javascript">
document.write("Hello World");
</script>
<noscript>
Hello Earth
</noscript>
A browser that supports JavaScript will display "Hello World", whereas a non-JavaScript-capable browser will display "Hello Earth" instead.
For more information on HTML tags you can visit the W3C HTML4 Elements [w3.org] page.
For specific information on the <noscript> tag, visit the Scripts in HTML [w3.org] page
You might consider using a document.write() something like this:
<script>
document.write("entire form tag")
</script>
<noscript>
list of text links
</noscript>
<script>
document.write("<FORM>
<SELECT>
<OPTION VALUE="pics/page1.html">Page 1
<OPTION VALUE="pics/page2.html">Page 2
<OPTION VALUE="pics/page3.html">Page 3
</SELECT>
<INPUT TYPE="button" VALUE="Go" onClick="jumpBox(this.form.elements[0])">
</FORM>")
</script>
<noscript>
Why doesn't this work?
</noscript>
1) put everything in one document.write, and use \n wherever you want a line break
2) use a separate document.write for each line
So, something like this would work:
<script type="text/javascript">
document.write("<FORM>\n<SELECT>\n<OPTION VALUE=\"pics/page1.html\">Page 1\n<OPTION VALUE=\"pics/page2.html\">Page 2\n<OPTION VALUE=\"pics/page3.html\">Page 3\n</SELECT>\n<INPUT TYPE=\"button\" VALUE=\"Go\" onClick=\"jumpBox(this.form.elements[0])\">\n</FORM>");
</script>
Note that quotes are escaped like this: \"
The text should be on the same line.