Forum Moderators: open
Here is the code:
<td><form>
<input type="hidden" name="Screen_Width" action="ss.htm" onload="screenwidth(this)"> <input type="image" src="f.gif"></td></form>
<script language="JavaScript"><!--
function screenwidth(res) {
res.value = screen.availWidth }
// --></script>
The onLoad event doesn't apply to the <input> tag. You can put that in the <body> tag.
Also, you haven't declared "res" anywhere except within your function.
Here's what might work:
<script>
var res="";
function screenwidth() {
res = screen.availWidth;
document.Form1.SW.value= res;
}
</script>
<body onLoad="screenwidth()">
<form name="Form1">
<input type="text" name="SW" value="">
</body>
Give that a try.
There is an excellent javascript tutorial at www.w3Schools.com