Home  >  Article  >  Backend Development  >  Combined use of javascript and select components_PHP tutorial

Combined use of javascript and select components_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:02:37930browse


//Combined use of Javascript and select components
//In the process of writing the program, I want to realize that after the option is selected in the select object,
//No submit button is required , and trigger the action directly, and the selected option must be maintained in the
// page after the action occurs. After describing it, I finally realized this function by using Javascript and the onchange attribute and
//value of the select object.
//The code is as follows (the file name is "test.php"):


switch ($mon){
case '': echo 'Please select your zodiac sign:'; break;
case '1':echo 'Your zodiac sign is Aquarius';break;
case '2':echo 'Your zodiac sign is Pisces';break;
case '3':echo 'Your zodiac sign is Aries';break;
case '4':echo 'Your zodiac sign is Taurus';break;
case '5':echo 'Your zodiac sign is Gemini';break;
case '6':echo 'Your zodiac sign is Cancer';break;
case '7':echo 'Your zodiac sign is Leo';break;
case '8':echo 'Your zodiac sign is Virgo';break;
case '9':echo 'Your zodiac sign is Libra';break;
case '10':echo 'Your zodiac sign is Scorpio';break;
case ' 11':echo 'Your zodiac sign is Sagittarius';break;
case '12':echo 'Your zodiac sign is Capricorn';break;
default:break;
}  
?>






[The copyright of this article is jointly owned by the author and Aosuo.com. If you need to reprint, please indicate the author and source]

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316463.htmlTechArticle?php //Combined use of Javascript and select components//In the process of writing the program, I want to achieve After the select object selects the option, //there is no need to submit the button, but the action is triggered directly, and in the action...
Statement:
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