87,926
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title> new document </title>
</head>
<body>
<select id="con_address">
<option value="a|b|c">选项1</option>
<option value="1|2|3">选项2</option>
</select>
<br>
<input type="text" id="h1">
<input type="text" id="h2">
<input type="text" id="h3">
<script>
var a = document.getElementById('con_address'),
b = [
document.getElementById('h1'),
document.getElementById('h2'),
document.getElementById('h3')
];
a.onchange = function(){
var c = this.value.split('|');
for(var i=c.length; i--;){
b[i].value = c[i];
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title> new document </title>
<script>
fillFrom = function(obj){
var c = obj.value.split('|');
for(var i=c.length; i--;){
b[i].value = c[i];
}
}
</script>
</head><body>
<input name="con_address" type="radio" value="a|b|c"/>选项1
<input name="con_address" type="radio" value="1|2|3" checked/>选项2
<br>
<input type="text" id="h1">
<input type="text" id="h2">
<input type="text" id="h3">
<script>
var a = document.getElementsByName('con_address'),
b = [
document.getElementById('h1'),
document.getElementById('h2'),
document.getElementById('h3')
];
for (var j=0;j<a.length;j++)
{
a[j].onclick = function(){
fillFrom(this);
}
}
window.onload = function(){
for (var k=0;k<a.length;k++)
{
if(a[k].defaultChecked) fillFrom(a[k]);
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title> new document </title>
</head>
<body>
<input name="con_address" id="con_address" type="radio" value="a|b|c" onclick="changeTxt(this)" />R选项1
<input name="con_address" id="con_address" type="radio" value="1|2|3" onclick="changeTxt(this)" checked/>R选项2
<br>
<input type="text" id="h1">
<input type="text" id="h2">
<input type="text" id="h3">
<script>
var a = document.getElementById('con_address'),
b = [
document.getElementById('h1'),
document.getElementById('h2'),
document.getElementById('h3')
];
window.onload=function(){
var c = a.value.split('|');
for(var i=c.length; i--;){
b[i].value = c[i];
}
}
function changeTxt(obj) {
var rv = obj.value.split('|');
for (var i = rv.length; i--; ) {
b[i].value = rv[i];
}
}
//alert(a.value);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title> new document </title>
<script>
fillFrom = function(obj){
var c = obj.value.split('|');
for(var i=c.length; i--;){
b[i].value = c[i];
}
}
</script>
</head><body>
<input name="con_address" type="radio" value="a|b|c" checked/>选项1
<input name="con_address" type="radio" value="1|2|3"/>选项2
<br>
<input type="text" id="h1">
<input type="text" id="h2">
<input type="text" id="h3">
<script>
var a = document.getElementsByName('con_address'),
b = [
document.getElementById('h1'),
document.getElementById('h2'),
document.getElementById('h3')
];
for (j in a)
{
a[j].onclick = function(){
fillFrom(this);
}
}
window.onload = function(){
for (k in a)
{
if(a[k].defaultChecked) fillFrom(a[k]);
}
}
</script>
</body>
</html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title> new document </title>
</head>
<body>
<select id="con_address">
<option value="a|b|c" selected>选项1</option>
<option value="1|2|3">选项2</option>
</select>
<br>
<input type="text" id="h1">
<input type="text" id="h2">
<input type="text" id="h3">
<script>
var a = document.getElementById('con_address'),
b = [
document.getElementById('h1'),
document.getElementById('h2'),
document.getElementById('h3')
];
a.onchange = function(){
var c = this.value.split('|');
for(var i=c.length; i--;){
b[i].value = c[i];
}
};
window.onload = function(){
var c = a.options[a.selectedIndex].value.split('|');
for(var i=c.length; i--;){
b[i].value = c[i];
}
}
</script>
</body>
</html>