Forum Moderators: open

Message Too Old, No Replies

Error message

         

maitre

6:52 pm on Oct 27, 2005 (gmt 0)

10+ Year Member



This function (it works fine) produces an IE error message:

<script language="javascript">
function load(){parent.document.getElementById('iframe1').src = "page1.htm" }
</script>
<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=700,height=580,left=250,top=50,location=yes,scrollbars=yes');
return false;
}
//-->
</SCRIPT>

It says " line 15, character 1 (that is the "w" window.open), invalid argument.

In Opera and Firefox there is no error message.

What am I doing wrong here?

JAB Creations

6:57 pm on Oct 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Maitre...

I'm still in the early stages of learning JavaScript but it looks like your code is missing proper syntax.

if (condition) {do this};
else if (condition) {do this};
else {do this};

Make sure you use () and {} where you should! It looks like it is missing where it needs to be.

It could also be something else or I could be completely off and it is completely something else.

Hope this helps though!

John

maitre

7:00 pm on Oct 27, 2005 (gmt 0)

10+ Year Member



JAB,

It's entirely possible that the syntax is wrong. The funny thing is that it works in all browsers just fine but only IE produces this message.

Bernard Marx

8:15 pm on Oct 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The syntax is fine as far as I can tell. Curly brackets are only needed if multiple statements are being used (or rather, curly brackets & contents are a single 'compound statement').

Can see any faults in the code, but then there is no visible call to the function, popup, in the quoted code, so I don't know what args are being used.