General Community > Scripting Help
Javascript problem...
Seph|roth:
Since there's no JS board, i'just posting this here ;)
Can someone see what's wrong with this piece of code?
--- Code: ---if ((screen.width == "1024") && (screen.heigth == "768")) document.write("1024"); else document.write("Res: (",screen.width,"x",screen.height,").");
--- End code ---
It writes my res as 1024x768 (which is correct) but the if-statement does not work, meaning the script does not return "1024" but instead print's the else-statement's result (which IS 1024x768)!! VERY strange :( or maybe i'm just overlooking something ;)
thanks in advance
Spaceman-Spiff:
try comparing it as a number, not string:
(screen.width == 1024) -> without quotes
though javascript doesnt really have datatypes...
Iridium:
Spelling "height" correctly in the if statement might help too (assuming that was a copy-and-paste job).
Seph|roth:
nope... that doen't work either
Seph|roth:
--- Quote from: Iridium on September 09, 2003, 02:46:06 PM ---Spelling "height" correctly in the if statement might help too (assuming that was a copy-and-paste job).
--- End quote ---
??? HEIGHT whats wrong with that?
EDIT: and no it's not a ctrl-c ctrl-v job ;)
Navigation
[0] Message Index
[#] Next page
Go to full version