JavaScript switch case

Source: Internet
Author: User
Tags switch case

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> dynamically change hyperlink text and address </title>
<link href= "Css/css.css" rel= "stylesheet" type= "Text/css" >
<script type= "Text/javascript" language= "JavaScript" >
function Netbankusername ()
{

Values=form.bankname.options[form.bankname.selectedindex].value;
Texts=form.bankname.options[form.bankname.selectedindex].text;

Switch (FORM.BANKNAME.SELECTEDINDEX)
{
Case 1:
Document.links[0].href= "http://www.cmbchina.com/";
Shownetbank1.innerhtml= "http://www.cmbchina.com/(China Merchants Bank)";
Document.links[0].href=values;
Shownetbank1.innerhtml=values+ "(" +texts+ ")";
Break
Case 2:
Document.links[0].href= "Http://www.cib.com.cn/netbank/netbank.portal";
Shownetbank1.innerhtml= "http://www.cib.com.cn/netbank/netbank.portal (Industrial Bank)";
Document.links[0].href=values;
Shownetbank1.innerhtml=values+ "(" +texts+ ")";
Break
Default
alert (Form.bankname.selectedIndex);
Break
}
}
</script>
<body>
<form action= "Cardinfo_action.asp?action=insert" method= "post" name= "form" id= "form" >
<table width= "border=" 0 ">
<tr>
<td> Please select </td>
<td>

<select name= "Bankname" onchange= "Netbankusername ()" id= "Bankname" >
<option value= "" > Please select </option>
<option value= "http://www.cmbchina.com/" > China Merchants Bank </option>
<option value= "Http://www.cib.com.cn/netbank/netbank.portal" > Industrial Bank </option>
<option value= "http://www.baidu.com" > Other </option>
</select></td>
</table>
</form>
<div style= "border:1px solid #ccc; margin:1px;width:600px;height:20px;" ><a href= "#" target= "_blank" id= "Shownetbank1" name= "Shownetbank1" > No bank selected </a></div>
</body>

JavaScript switch case

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.