Page is a not externally linkable
- Code, Content, and Presentation
-- HTML
---- I can populating a text field from drop down. Help make it populating two text fields


birdbrain - 12:17 am on Apr 14, 2012 (gmt 0)


Hi there basketmen,

that input was not there in your original post. :(

Why have you put it there?

Would it not be be better place it like this...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">

<title></title>

<style type="text/css">
body {
background-color:#f0f0f0;
}
#theform {
float:left;
padding:20px;
border:1px solid #999;
background-color:#fff;
box-shadow:#666 2px 2px 8px;
}
#theform div {
margin:5px 0;
}
</style>

<script type="text/javascript">

function init(){

df=document.forms[0];

df[0].onchange=function(){
if(this.value!='') {

/* this will work regardless of the amount of space between values */

df[1].value=this.value.split(/\s+/)[0];
df[2].value=this.value.split(/\s+/)[1];
df[3].value=this.value.split(/\s+/)[2];

/*******************************************************************/
}
}

df.onsubmit=function(){
return CheckForm();
}
}
function CheckForm(){

}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
</script>

</head>
<body>


<form id="theform" action="#">
<div>
<select name="myOptions">
<option value="">Please select an option</option>
<option value="1a 1b 1c">1</option>
<option value="2a 2b 2c">2</option>
<option value="3a 3b 3c">3</option>
<option value="4a 4b 4c">4</option>
</select>
</div><div>
<input type="text" name="showValue">
</div><div>
<input type="text" name="showValue2">
</div><div>
<input type="text" name="showValue3">
</div><div>
<input type="submit">
<input type="reset">
</div>
</form>

</body>
</html>

birdbrain


Thread source:: http://www.webmasterworld.com/html/4440347.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com