IF Statement in ASP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hollywood115
    New Member
    • Feb 2008
    • 16

    IF Statement in ASP

    im having trouble incorporating an if statement into the ASP page.
    this is what i have:

    <div id="text" runat="server" style="display: none; position: absolute; width: 350; text-align: right">
    </div>

    so what i need to do is check if the resolution is less than 1024 pixels wide and if it is i need to make that statement:

    <div id="text" runat="server" style="display: none; position: absolute; width: 350; text-align: right; left:400">
    </div>

    i saw on some sites to try:
    <% IF screen.width < 1024 THEN %>
    code....
    <%ELSE %>
    code...
    <%End IF %>

    but for it doesnt seem to be working..
    any help would be appreciated.
  • CroCrew
    Recognized Expert Contributor
    • Jan 2008
    • 564

    #2
    Hello hollywood115,

    Here is a bit of JavaScript that you can inject to check screen sizes. What you are trying to do is best done via client side scripting.

    Hope this helps~


    Code:
    <script language="JavaScript">
    	var correctwidth=1024; var correctheight=768;
    	if (screen.width<correctwidth)
    	{
    		alert("This web site is bested viewed with a screen resolution set to "+correctwidth+"*"+correctheight+" or higher. Your current resolution is "+screen.width+"*"+screen.height+". If possible, please change your screen resolution.");
    	}
    </script>

    Comment

    • hollywood115
      New Member
      • Feb 2008
      • 16

      #3
      hey, thanks for the tip.
      but i really need it to actually make it viewable in all resolutions.
      any ideas on making it viewable and not just alerting?

      thanks for ur help.

      Originally posted by CroCrew
      Hello hollywood115,

      Here is a bit of JavaScript that you can inject to check screen sizes. What you are trying to do is best done via client side scripting.

      Hope this helps~


      Code:
      <script language="JavaScript">
      	var correctwidth=1024; var correctheight=768;
      	if (screen.width<correctwidth)
      	{
      		alert("This web site is bested viewed with a screen resolution set to "+correctwidth+"*"+correctheight+" or higher. Your current resolution is "+screen.width+"*"+screen.height+". If possible, please change your screen resolution.");
      	}
      </script>

      Comment

      • CroCrew
        Recognized Expert Contributor
        • Jan 2008
        • 564

        #4
        Hello hollywood115,

        Can you give some more detail on exactly what you’re trying to do? The more details you give us the more exact solution we can provide.

        Thanks~

        Comment

        • hollywood115
          New Member
          • Feb 2008
          • 16

          #5
          Thanks for your help but i have figured out how to do what i needed.
          thanks though! :)

          Comment

          Working...