...

View Full Version : Javascript Question??? Need Help



lmod
08-23-2004, 05:46 AM
I have a script that I need to finish. I want to use JavaScript to detect a users screen resolution then post it back to the server so I can get it in ASP.

This is what I have:
<HTML>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function resolution() {
colors = window.screen.colorDepth;
document.form.colordepth.value = window.screen.colorDepth;
document.form.width.value = window.screen.width;
document.form.height.value = window.screen.height;
}
//--></script>
</head>
<body OnLoad="resolution()">
<form action="nistemp.asp" name=form>
<input type=text name=width value="width.value">
<input type=text name=height>
<input type=text name=colordepth>
<input type=text name=i value="<%=nis%>">
</form>
<script type='text/javascript'>document.form.submit();</script>
</body>
</HTML>

Now Without the document.form.submit I see the values in the forms but They dont go to the server when I submit because I have no value set for each form.

Problem:
How do I achieve this:
<input type=text name=height value="JS Variable???????">

jamescover
08-23-2004, 06:45 AM
Now Without the document.form.submit I see the values in the forms but They dont go to the server when I submit because I have no value set for each form.

It's not apparent why you need a form to do this? What are you doing with the values in ASP?


How do I achieve this:
<input type=text name=height value="JS Variable???????">

var colors = window.screen.colorDepth;
etc.


-james

dumpfi
08-23-2004, 05:38 PM
<html>
<head>
<script type='text/javascript'>
function resolution() {
self.location.href = 'nistemp.asp?width=' + window.screen.width + '&height=' + window.screen.height + '&colordepth=' + window.screen.colorDepth + '&i=<%=nis%>';
}
window.onload = resolution;
</script>
</head>
<body>
</body>
</html>
dumpfi



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum