I'm getting an error in line 13 and don't know why. Can someone help me please?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script language="JavaScript">

 

function popUp(URL) {

eval("page" + id + " = window.open(URL, '" + id + "', '

toolbar=1,

scrollbars=1,

location=1,

statusbar=1,

menubar=1,

resizable=1,

width=500,

height=500,

left = 390,

top = 150');");

}

</script>




</head>

<body>

<form>

<input type=button value="Open Popup" onClick="javascript:popUp('www.rrc.mb.ca')">

</form>


</body>
</html>

So I would put the URL: in the ID place?

either that, or define an id, but since you pass URL as a param to that function and don't use it otherwise, that might very well solve your problem.

  • Javascript does not allow a quoted string definition to be broken by line feeds.
  • There's no need to use eval() . It should be fairly easy to find a work-around to avoid it.
  • id is undefined unless it is in an outer scope (eg the global scope).

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.