PDA

View Full Version : JavaScript not showing up, only changed one thing.


thewickedjester
09-16-2004, 12:32 AM
Ok, i have been searching for like 45 minutes and cant find any reason why this isnt working. its a screen resolution detector that i got of javascriptkit.com. the only thing i changed was what the correct resolution should be. when i run the site with the javascript code it in, it does nothing.

I have tried it in both Mozilla Firefox, and IE and am out of ideas

<script language="JavaScript1.2">
<!--

/*

Screen resolution detecter script: By JavaScript Kit (www.javascriptkit.com) More free scripts here! Note: Credit must stay intact for use.

*/

var correctwidth=800
var correctheight=600
if (screen.width<correctwidth||screen.height<correctheight)
document.write("This webpage is bested viewed with screen resolution "+correctwidth+"*"+correctheight+" or above. Your current resolution is "+screen.width+"*"+screen.height+". If possible, please change the resolution!")
//-->
</script>


also, would it affect this javascript from running if i had another javascript for some mouse overs running before it?

hemebond
09-16-2004, 01:13 AM
<script type="text/javascript">
// code here. do not enclose in quotes
</script>And rather than try and detect what resolution the user is running, why not build your web-pages properly, so they can be viewed by anyone and everything?

thewickedjester
09-16-2004, 01:53 AM
got it working, thanks.

and to answer your question hemebond: i would like to program it to be the "correct" way, but some of my images are image maps get distorted when i program it for a certain resolution but then test it on another, so my solution is to program for 800x600, and inform the user that if he doenst run 800x600, the page still works but the images may be a little messed up. if you have any suggestions on this, i would be happy to hear them cause im just doing this the way my web design teacher told me.

hemebond
09-16-2004, 09:02 AM
im just doing this the way my web design teacher told me.They're the biggest culprits. Do you have a link to the site I can check out?