Javascript error on my site (only error in opera, not in firefox 3.6 or IE8)

Forums » Dev.Opera » General Web Development Discussions

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

10. April 2010, 08:20:11

digtokiller

Posts: 1

Javascript error on my site (only error in opera, not in firefox 3.6 or IE8)

Hello all out there, i have a site for my school and the first site got this code:

i removed <> in script lang so you can see it.

SCRIPT language="JavaScript"

if ((screen.width>=1359) && (screen.height>=767))
{
window.location="default1.php";
}
if ((screen.width==1280) && (screen.height==1024))
{
window.location="default2.php";
}
else
{
<script language="javascript">alert("Din skærmopløsning: " + screen.width + " * " + screen.height + " er for lav. Skift din opløsning til mindst 1280*1024 og gå til http://elevraad-hvsk.dk/test/ for at tjekke igen" )</script>;}

/SCRIPT


this should check if your you use higher resoluttion than 1359*767 or if you use 1280*1024 and if you use lower you will get a warning.
very simple and it works in firefox 3.6 and IE8 but not in opera...
i get this warning:

JavaScript - http://elevraad-hvsk.dk/size.test.php
Inline script compilation
Syntax error at line 13 while loading:
<script language="ja
^
expected expression, got '<'


what does that mean?? and any idea how to fix?

11. April 2010, 21:45:59

mascot

Posts: 19

Opera shows an error because you embedded inside the else branch another (unnecessary) script tag. Shame on all those browser that ate it without a notice.

Forums » Dev.Opera » General Web Development Discussions