JS點擊按鈕,提示確認後跳轉網頁,並可傳遞參數

綜合參考:javascript

http://jingyan.baidu.com/article/47a29f242b180ac0142399f9.html
html

http://blog.csdn.net/hshl1214/article/details/46744387
java

<html>
<!--http://jingyan.baidu.com/article/47a29f242b180ac0142399f9.html-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function duihua()
{
alert("這個窗口是對話框!")
}

function queren(id)
{
var res=confirm("請選擇點擊一個按鈕!");
if (res==true)
  { 
  //alert("你按下的是【確認】");
  //跳轉到指定頁面並傳遞id參數
  window.location.href="http://test.com/userlist?param="+id;
  }
else
  {
  alert("你按下的是【取消】");
  }
}

function tishi()
  {
  var t=prompt("請輸入您的名字","KING視界")
  if (t!=null && t!="")
    {
    document.write("精彩MV就在," + t + "!屬於你的世界")
    }
  }
</script>
</head>
<body>

<input type="button" onclick="duihua()" value="點擊顯示對話框" />
<input type="button" onclick="queren()" value="點擊顯示確認框" />
<input type="button" onclick="tishi()" value="點擊顯示提示框" />

</body>
</html>



示例:ide

wKiom1mgxcvzWl58AAA06_fnwuM920.jpg

相關文章
相關標籤/搜索