what is wrong in my Window.open script?

Hi all,
i try to open a window by clicking hyperlink. but i got Syntax error.
can anyone tell me what is wrong in my script?
var link = "Notes"
//syntax error for this one
var commentUrl = "<a href='javascript: void(0)' onclick='window.open('list.aspx', 'mywindow');return false;' >" + link + "</a>";

*********************
but if i use the following, everything works:
var commentUrl = "<a href='list.aspx'>" + link + "</a>";

Open in new window

LVL 6
viola123Asked:
Who is Participating?
 
jessc7Connect With a Mentor Commented:
Try this:
var commentUrl = "<a href=\"javascript: void(0)\" onclick=\"window.open('list.aspx', 'mywindow');return false;\" >" + link + "</a>";

Open in new window

0
 
evedderCommented:
mmm i have not tried <a href='javascript: void(0)'...etc.

but when  i need to open in a new window i use <a href='#' onclick='javascript:window.open(...etc.

maybe this can help?
0
 
viola123Author Commented:
jessc7:
thanks, it works very well.

evedder:
thanks for help

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.