<head runat="server">
<title></title>
<script type="text/javascript">
var RestID = 2;//javascript變量
function a() {//javascript函數
window.open("showNews.aspx?id= " + RestID);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<script language="javascript" type="text/javascript">
var str1,str2
str1="fdsgdg dsfdsf china"
str2="武漢市廣播電視大學"
document.write("顯示字符串1:"+str1+"<br>")
document.write("顯示字符串2:" + str2 + "<br>")
//document.write()函數的寫法很重要,寫好才能正確的讀到javascript的參數
<span style="color:#ff6666;">//方式壹,打開新窗口,轉到新鏈接
</span> document.write(" <a href= 'showNews.aspx?id="+RestID+"' style='text-decoration:none; color:Black;' target='_blank'> 目標頁 </a> ")
</script>
<span style="color:#ff9966;">//方式二,使用javascript:location.href,但是不能在新窗口中打開鏈接
</span> <a href= "javascript:location.href= 'showNews.aspx?id= ' + RestID " style=" text-decoration:none; color:Black;" target="_blank"> 目標頁 </a>
<span style="color:#33cc00;">//方式三,使用javascript:open,只能在搜狗瀏覽器裏打開,在IE、火狐、360瀏覽器裏面都打不開,就是說明這個方法不太好
</span> <a href= "javascript:open( 'showNews.aspx?id= ' + RestID)" style=" text-decoration:none; color:Black;" target="_blank"> 目標頁 </a>
<span style="color:#ff6666;">//方式四使用window.open但是鼠標為箭頭而不是表示鏈接時的手型,
</span> <a onclick= "window.open( 'showNews.aspx?id= ' + RestID)" style=" text-decoration:none; color:Black;" target="_blank"> 目標頁 </a>
<span style="color:#009900;">//方式五調用 javascript函數 ,但是鼠標為箭頭而不是表示鏈接時的手型,
</span>
<a onclick= "javascript:a()" style=" text-decoration:none; color:Black;" target="_blank"> 目標頁 </a></form>
</body>
</span>