|
-
Jun 21st, 2000, 07:32 AM
#1
Thread Starter
Hyperactive Member
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.
-
Jun 23rd, 2000, 05:49 PM
#2
Monday Morning Lunatic
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
-
Jun 24th, 2000, 12:12 AM
#3
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|