Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-23-2004, 04:46 AM   PM User | #1
lmod
New Coder

 
Join Date: Aug 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
lmod is an unknown quantity at this point
Javascript Question??? Need Help

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???????">
lmod is offline   Reply With Quote
Old 08-23-2004, 05:45 AM   PM User | #2
jamescover
Regular Coder

 
Join Date: Aug 2002
Location: USA
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
jamescover is an unknown quantity at this point
Quote:
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?

Quote:
How do I achieve this:
<input type=text name=height value="JS Variable???????">
var colors = window.screen.colorDepth;
etc.


-james
__________________
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

Last edited by jamescover; 08-23-2004 at 05:50 AM..
jamescover is offline   Reply With Quote
Old 08-23-2004, 04:38 PM   PM User | #3
dumpfi
Regular Coder

 
Join Date: Jun 2004
Posts: 565
Thanks: 0
Thanked 18 Times in 18 Posts
dumpfi will become famous soon enough
Code:
<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
dumpfi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:48 PM.


Advertisement
Log in to turn off these ads.