If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Is there a way to detect the client window's width?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-05, 14:23
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Is there a way to detect the client window's width?

I need to know the width of the client window and then I can pick the background file to show. Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 01-18-05, 17:03
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
I found the way to get the width of the client's screen using JavaScript screen.availWidth. But when I put the following code in my page

<head>
<title>My Page</title>
<SCRIPT language="JavaScript1.2">
<!--
<% Dim backgroundFile %>
function loadBackgroundFile() {
var sw = screen.availWidth;
if (sw <= 800) {
<% backgroundFile = "../images/background1.jpg" %>;
}
else {
<% backgroundFile = "../images/background2.jpg" %>;
}
}
//-->
</SCRIPT>
</head>

<body bgcolor="#808080" bottommargin="3" leftmargin="3" rightmargin="3" topmargin="3" onload="loadBackgroundFile();">

it always shows background2.jpg even when the width is changed to 1024. Does someone give a help? Thanks.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On