Home > php教程 > php手册 > body text

对&#106avascript和select部件的结合运用

WBOY
Release: 2016-06-13 12:38:33
Original
827 people have browsed it


//对Javascript和select部件的结合运用
//在写程序的过程,我想实现在select对象选中选项后,
//不需要提交按钮,而直接触发动作,且在动作发生后
//的页面中要保持所选择的选项。经过形容,终于通过
//使用Javascript及select对象的onchange属性及
//value值而实现了这种功能。
//代码如下(文件名为"test.php"):


  switch ($mon){
    case '': echo '请选择您的星座:';break;
    case '1':echo '您的星座是水瓶座';break;
    case '2':echo '您的星座是双鱼座';break;
    case '3':echo '您的星座是白羊座';break;
    case '4':echo '您的星座是金牛座';break;
    case '5':echo '您的星座是双子座';break;
    case '6':echo '您的星座是巨蟹座';break;
    case '7':echo '您的星座是狮子座';break;
    case '8':echo '您的星座是处女座';break;
    case '9':echo '您的星座是天平座';break;
    case '10':echo '您的星座是天蝎座';break;
    case '11':echo '您的星座是射手座';break;
    case '12':echo '您的星座是魔蝎座';break;
    default:break;
  }       
?>


  




【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!