Results 1 to 3 of 3

Thread: Screen Resolution

  1. #1

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268

    Question

    Does anyone know some code that will determine the screen resolution in VBScript?

    I've got a navbar on my web page and the alignment of some of the links are off with some resolutions. Here is a sample of what I need:

    Code:
    If ScreenResolution > "800 X 600" Then Document.Write "<BR>"
    I don't really have any VBScript experience, but I know it better than Javascript. I'll take any language I can get.
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    well, you can't use operators like that on a string - what you're doing is checking whether the string itself is greater. what you need is to chop it up, collect the different sizes, and compare them. alternatively, you can use Screen.Width and Screen.Height (I think).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Junior Member
    Join Date
    May 2000
    Posts
    28
    Ok, you still need the ==, but you also have to use parenthesis to enclose your argument for the document.write command. (document.write("blah") writes blah while .write(blah) writes the value of blah. If you try .write "blah"; it chokes. This code works. (&& is And)

    <script language="JavaScript"><!--
    if ((screen.width ==800)&&(screen.height ==600))
    {
    document.write ("600x800");
    }
    if ((screen.width ==1024)&&(screen.height ==768))
    {
    document.write ("768x1024");
    }
    //--></script>

    Alternatively, if you're actually using the "<br>" tag to position an element on your page, you might try using a style sheet. So if you wanted to move a link:

    <a id=thing_to_move href=#>click</a>

    if ((screen.width ==800)&&(screen.height ==600))
    {
    document.write ("<style><!--#thing_to_move{position:absolute;left:50px;top:50px;}--></style>");
    }

    [Edited by billyo on 06-24-2000 at 03:01 PM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width