Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Window width

Status
Not open for further replies.

cjulio

Programmer
Aug 14, 2002
114
PT
I need to get the ie windows width without using the onload function. isthere a way to do this only in asp
 
you could use JavaScript

<script type="text/javascript">
winwidth=document.all?document.body.clientwidth:window.innerwidth;
winHeight=document.all?document.body.clientheight:window.innerHeight;
</script>

if you needed to do it on page load, you could place it in a javaScript function and call it using the RegisterStartUpScript method
 
you could use JavaScript

Code:
<script type="text/javascript"> 
winwidth=document.all?document.body.clientwidth:window.innerwidth; 
winHeight=document.all?document.body.clientheight:window.innerHeight; 
</script>

if you needed to do it on page load, you could place it in a javaScript function and call it using the RegisterStartUpScript method
 
i have just now started in asp and java sctip a everithing else

how do i use winwidth var in asp
 
First of all, please ignore my registerStartUpScript rubbish, i posted in the wrong forum and then assumed i was in the ASP.Net one, sorry about that.

you dont use it directly within ASP, its client side and asp is server side.

How do you want to use the variables?? if you want to manipulate the screen in any way then you need to do it using JavaScript. I would write an example for you, but i really hate writing javaScript at the best of times due to its buggy nature. What i would do is google the terms JavaScript and DOM hopefully it will point you in the right direction.

Rob
 
<body>

<div id="divprimario" style="position:absolute; width:650px; top: 170px; left: <%ESQUERDA%>px;">


what i whant is to change the div place if i put te code in the funcion onload, only after the page is loaded thoes div change place

i whant to do is assign the left of the div to a variable and when the div apears it apears in the right place
 
The only way your going to be able to get the window width to the server is if you have some sort of intro page or something that a javascript function grabs the width and reports it back to the server. On that note, if you just want to change the position, why not st the right size instead of the left?

<div id="divprimario" style="position:absolute; width:650px; top: 170px; right 0px;">

Nw you have a div that will always sit on the right side of the screen.

My suggestion would be to look at some examples on multi-column CSS layouts. I learned a lot of ways to get around having to use dynamic values from those types of sites simply by looking through their example code.

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top