[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

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

0
viola123
Asked:
viola123
1 Solution
 
jessc7Commented:
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now