473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Using user screen widths in ASP

I'm trying to modify some web pages so that the table column widths can vary depending on the user's screen width, but can't seem to find how to do it.

I know in Javascript I can use Screen.width to obtain the browser width, but am baffled as to how to get ASP to be able to capture that so I can dynamically make the widths adjust based on this. Please advise, thanks.
Jul 25 '07 #1
1 3476
jhardman
3,406 Expert 2GB
I'm trying to modify some web pages so that the table column widths can vary depending on the user's screen width, but can't seem to find how to do it.

I know in Javascript I can use Screen.width to obtain the browser width, but am baffled as to how to get ASP to be able to capture that so I can dynamically make the widths adjust based on this. Please advise, thanks.
This info is not sent to the server unless you do it manually, by using javascript or some such. I did it once by getting the info in javascript, putting the info in a form, then immediately submitting the form. This part was all in an if statement that executed only if no form info had been sent, so the rest of the page could be filled with exactly the stuff I needed. Here's my code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>test page</title>
  4. <script language="JavaScript">
  5. <!-- Begin
  6. function rP(inH, inW, frm) {
  7.    inH.value=screen.height;
  8.    alert(screen.height+ " " + inH.value);
  9.    inW.value=screen.width;
  10.    frm.submit();
  11. }
  12. // END -->
  13. </script>
  14.  
  15.  
  16. </head>
  17. <%
  18. if request("height") = "" then %>
  19. <body onload="rP(this.document.all.bob.height,
  20.  this.document.all.bob.width,
  21.  this.document.all.bob)">
  22. <form name="bob" action="test2.asp" method="post">
  23. <input type="hidden" name="height">
  24. <input type="hidden" name="width">
  25. </form>
  26.  
  27. <%
  28. else %>
  29. <body>
  30. Height=<%=request("height")%><br>
  31. width=<%=request("width")%><br>
  32. <%
  33. end if %>
  34. </body>
  35. </html>
Jared
Jul 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: RelaxoRy | last post by:
I have 2 screen sizes I want to accomodate for. screen.width <= 800 and > 800. This is because If it's one or the other, I want a different set of menu graphics, and to set variables for my...
1
by: TB | last post by:
Hi All: I have this datagrid where space is very tight, and therefore I have to make sure that everything fits within a fixed screen width regardless of whether I am in list mode or in edit...
5
by: VJ | last post by:
Is there a any known easy way to fit web pages for a screen resolution. Can I do this programmatically? VJ
4
by: Doug van Vianen | last post by:
Hi, I have the following coding on a web page. It causes two pictures (pic1.jpg and pic2.jpg) to show, one above the other and then when one clicks on the top picture is squeezes to the left...
11
by: Grischa Brockhaus | last post by:
Hi, I'm trying to produce a div layout containing a header on the top with fixed height, a footer on the bottom using fixed height and a content layer using what's left of the browsers window. ...
35
by: Friendly_Lola | last post by:
What Screen Resolution do You use? 800 X 600 1024 X 768 1280 X 1024 Wow! 1600 X 1200 (i can't imagine this) I use 1024 X 768. For what resolution you optimize your web pages?
8
by: Gary | last post by:
I'm using an Act database. I was stuck on this a year ago and am still having trouble. I have three bits of code like so : - act.CActAppObj objACT = new act.CActAppObj(); act.CAIBaseView...
6
by: trbjr | last post by:
Hello experts, I want to describe a project design and then ask some questions at the end. There is no code in this discussion, just symbols to illustrate an idea. Let S stand for a screen...
6
Markus
by: Markus | last post by:
Ello. I'm trying to set the widths for my first three rows of cells and then have a bottom row with different cell widths. However, the first three rows take on the same widths as the bottom row. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.