html标记中格式为<a href="url"> text </a>
此时,内容在原来窗口呈现,如果想新开窗口,可以采用下列方式。
1. <a href="http://www.baidu.com/" onclick="window.open( this.href, ‘_blank‘, ‘scrollbars=0,sesizebar=0,sesizeable=0,width=300‘ );return false"> Click </a>
2. <a href="javascript:;" onClick="javascript:window.open(‘http://www.baidu.com/‘,‘‘,‘width=600,height=500,left=10, top=10,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes‘);return false;"> Click </a>
html代码
<html> <head> <title>open new page</title> <http-equiv="Content-Type" content="html"; charset="utf-8" /> <script type="javascript"> function OpenPage(){ alert( "click" ); window.open( "http://www.baidu.com/", "_blank", "scrollbars=yes, sizebar=0, resizeable=yes" ); return false; } function fun1(){ alert( "ok" ); } </script> </head> <body> <p> <!-- <a href="http://www.baidu.com/" onclick="window.open( this.href, ‘_blank‘, ‘scrollbars=0,sesizebar=0,sesizeable=0,width=300‘ );return false"> Click </a> --> <!-- <a href="javascript:;" onclick="OpenPage()"> Click </a> --> <!-- <a href="javascript:;" onClick="javascript:window.open(‘http://www.baidu.com/‘,‘‘,‘width=600,height=500,left=10, top=10,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes‘);return false;"> Click </a> --> </p> <input type="button" id="button1" value="Show" onClick="func1()" /> </body> </html>