欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS實(shí)現(xiàn)點(diǎn)擊下拉列表文本框中出現(xiàn)對應(yīng)的網(wǎng)址,點(diǎn)擊跳轉(zhuǎn)按鈕實(shí)現(xiàn)跳轉(zhuǎn)

 更新時(shí)間:2019年11月25日 13:44:46   作者:若年封塵  
這篇文章主要介紹了JS實(shí)現(xiàn)點(diǎn)擊下拉列表文本框中出現(xiàn)對應(yīng)的網(wǎng)址,點(diǎn)擊跳轉(zhuǎn)按鈕實(shí)現(xiàn)跳轉(zhuǎn),本文給大家分享實(shí)例代碼,代碼簡單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

程序要求:

編寫一個(gè)html文件的網(wǎng)頁代碼,頁面包含一個(gè)下拉列表框、一個(gè)文本框和一個(gè)按鈕,下拉列表框選擇要去的網(wǎng)站,當(dāng)選擇完畢后文本框中出現(xiàn)對應(yīng)的網(wǎng)址。點(diǎn)擊確認(rèn)跳轉(zhuǎn)按鈕后訪問文本框中出現(xiàn)的網(wǎng)址。

實(shí)現(xiàn)效果:

實(shí)現(xiàn)代碼:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>JavaScript事件</title>
</head>
<body>
  <select id="select_www" onchange="surf()">
    <option value="0" selected="selected">請選擇</option>
    <option value="http://www.baidu.com">百度</option>
    <option value="http://www.163.com">網(wǎng)易</option>
    <option value="http://www.qq.com">qq</option>
    <option value="http://www.sina.com.cn">新浪</option>
  </select>
  <input type="text" id="textbox">
  <button value="" id="button_www" onclick="jump()">確認(rèn)跳轉(zhuǎn)</button>
</body>
<script type="text/javascript">
  function surf(){
    select=document.getElementById("select_www").value;
    switch(select){
      case "http://www.baidu.com" :
      document.getElementById("textbox").value="http://www.baidu.com";
      break;
      case "http://www.163.com" :
      document.getElementById("textbox").value="http://www.163.com";
      break;
      case "http://www.qq.com" :
      document.getElementById("textbox").value="http://www.qq.com";
      break;
      case "http://www.sina.com.cn" :
      document.getElementById("textbox").value="http://www.sina.com.cn";
      break;
    }
  }
  function jump(){
    location=document.getElementById("textbox").value;
  }
</script>
</html>

總結(jié)

以上所述是小編給大家介紹的JS實(shí)現(xiàn)點(diǎn)擊下拉列表文本框中出現(xiàn)對應(yīng)的網(wǎng)址,點(diǎn)擊跳轉(zhuǎn)按鈕實(shí)現(xiàn)跳轉(zhuǎn),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

最新評論