当前位置:编程学习 > JS >>

js switch 教程

function tybsoso(son){
 tnum=son;
 var qtext1=document.getElementById('qbtext1').value;
 var qtext2=document.getElementById('qbtext2').value;
 var qtext3=document.getElementById('qbtext3').value;
 var qtext4=document.getElementById('qbtext4').value;
 switch (tnum)
 {
  case '1':
  gotourl="http://data.2008.163.com/searchs/index.html?q="+qtext1;
  gotourl=encodeURI(gotourl);
  break;
  case '2':
  gotourl="http://data.2008.163.com/searchs/news.html?q="+qtext2;
  gotourl=encodeURI(gotourl);
  break;
  case '3':
  gotourl="http://data.2008.163.com/searchs/data.html?q="+qtext3;
  gotourl=encodeURI(gotourl);
  break;
  case '4':
  gotourl="http://data.2008.163.com/searchs/image.html?q="+qtext4;
  gotourl=encodeURI(gotourl);
  break;
 }
 window.open(gotourl);
}

补充:网页制作,js教程 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,