executing javascript at the server for htm file

B

bbxrider

i have javascript code that creates some of my html code, e.g.
</SELECT>
year* <SELECT size=1 name="dobYYYY">
<script type="text/javascript" RUNAT="Server">
d = new Date();
var year = d.getFullYear();
year = parseFloat(year);
for (i = year; i > (year - 80) ; i--) {
document.write("<OPTION> " + i);
}
</script>
</SELECT><BR><BR>
so i get an 80 year table without having to code all 80 lines,

so if i want the 'final' html code to pass the validation test and/or not
have it viewable in the source,
how i generate it at the server with vbscript or javascript
 
L

Lasse Reichstein Nielsen

bbxrider said:
i have javascript code that creates some of my html code, e.g. ....
<script type="text/javascript" RUNAT="Server"> ....
for (i = year; i > (year - 80) ; i--) {
document.write("<OPTION> " + i);
}
</script>
so if i want the 'final' html code to pass the validation test and/or not
have it viewable in the source,
how i generate it at the server with vbscript or javascript

That depends on your web server. I assume it runs some kind of ASP.

Try changing the script tag to
<script language="JScript" runat="server">
and change the document.write line to
Response.Write("<option> "+i+"<\/option>");
}

Disclaimer: Just started dabbling in ASP.
/L
 

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

Staff online

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top