changing stylesheet for screen res (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


yogaboy -> changing stylesheet for screen res (9/21/2004 18:34:39)

Hello Outfronters,

I've been trying to change the stylesheet used depending on the user's screen res. I made this code, it picks up the screen res no probs, and the ASP code picks up the ScreenWidth from the VBScript (I can get it to Response.Write ScreenWidth for example), it's just not including the css file. Can anyone see why?? I'm new to ASP and it's starting to do my head in!!![:(]
Iain
<script language="vbscript">
	<!--
	Dim ScreenWidth
					
	ScreenWidth = window.screen.width
	-->    
</script>

<%		       
	If ScreenWidth = 800 then
  
                   <!-- #INCLUDE FILE="css800.txt"-->
                else 
    	   <!--#INCLUDE FILE="css1024.txt"-->
    	 End if	 
%>




Spooky -> RE: changing stylesheet for screen res (9/22/2004 1:38:40)

<SCRIPT LANGUAGE="JavaScript">
<!--
var xy = navigator.appVersion;
xz = xy.substring(0,4);
document.cookie = "ScreenWidth=" + screen.width
document.cookie = "ScreenHeight=" + screen.height
// -->
</script>

<%
strScreenWidth = Request.Cookies("ScreenWidth")
strScreenHeight = Request.Cookies("ScreenHeight")
If strScreenWidth = "" Then strScreenWidth = 800
If strScreenHeight = "" Then strScreenHeight = 600
%>
<%
Response.Write("Your screen width is: " & strScreenWidth & "<br>")
Response.Write("Your screen height is: " & strScreenHeight)
%>

However, on first vist the cookie is not retrieved till you refresh the page




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
6.054688E-02