Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript window.open doesn't work

Tags:

javascript

I want to use window.open to open a window to one of my JSP file. But the browser keeps showing connecting... And even firebug stops working every time I click the text. Neither the p nor the input tags work, but when I use a href to link the JSP it can link to the file:

<!DOCTYPE html>
<html>
<head><title>Sample JSP Page</title>
<script>
function open(){
    //window.open("hello.jsp","hello","height=700, width=800");
    var x=window.open("hello.jsp","window","status=1,height=700, width=800");
    x.focus();
}
</script>
</head>
<body>
<h1>Sample JSP Page</h1>
<p onclick="open()">do not work</p>
<form>
<input type="button" value="new window" onclick="window.open('test-with-utils')"></form>
</body>
</html>
like image 390
ethan Avatar asked Nov 14 '12 04:11

ethan


1 Answers

That's because you have redefined window.open when you defined the function open. Use a different function name instead.

like image 175
Herbie Avatar answered Oct 06 '22 01:10

Herbie