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">
<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 + "', '









left = 390,

top = 150');");






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



Recommended Answers

id is undefined.

Jump to Post

If that is what you want.

Jump to Post

All 5 Replies

id is undefined.

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

If that is what you want.

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).


Be a part of the DaniWeb community

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