The code is very simple, I won’t talk much nonsense here. Friends, please read the source code directly.
The code copy is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Dynamic change of 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>
</head>
<body>
<form action="cardinfo_action.asp?action=insert" method="post" name="form" id="form">
<table>
<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">Industry 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>
</html>
Isn't it super simple and practical? . . If you often look at larger sites, you can still get a lot of good things.