Forum Moderators: open
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name="theform" onsubmit="CheckForm()">
<select name="myOptions" onchange="document.theform.showValue1.value=this.value">
<option value="">Please select an option</option>
<option value="1a">1</option>
<option value="2a">2</option>
<option value="3a">3</option>
<option value="4a">4</option>
</select>
<input type="text" name="showValue1"><br>
</form>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name="theform" onsubmit="CheckForm()">
<select name="myOptions" onchange="document.theform.showValue1.value=this.value & document.theform.showValue2.value2=this.value2">
<option value="">Please select an option</option>
<option value="1a"& value2="1b">1</option>
<option value="2a"& value2="2b">2</option>
<option value="3a"& value2="3b">3</option>
<option value="4a"& value2="4b">4</option>
</select>
<input type="text" name="showValue"><input type="text" name="showValue2"><br>
</form>
</body>
</html>
<!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.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">1</option>
<option value="2a 2b">2</option>
<option value="3a 3b">3</option>
<option value="4a 4b">4</option>
</select>
</div><div>
<input type="text" name="showValue">
</div><div>
<input type="text" name="showValue2">
</div><div>
<input type="submit">
<input type="reset">
</div>
</form>
</body>
</html>
Ah :)I wondered why you hadn't mentioned it to him :)!
<!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.onsubmit=function(){
return CheckForm();
}
}
function CheckForm(){
}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
</script>
</head>
<body>
<form id="theform" action="#">
<input type="text" name="showValue3">
<div>
<select name="myOptions">
<option value="">Please select an option</option>
<option value="1a 1b">1</option>
<option value="2a 2b">2</option>
<option value="3a 3b">3</option>
<option value="4a 4b">4</option>
</select>
</div><div>
<input type="text" name="showValue">
</div><div>
<input type="text" name="showValue2">
</div><div>
<input type="submit">
<input type="reset">
</div>
</form>
</body>
</html>
<!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>
<!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[2].onchange=function(){ /* form element number 2 */
if(this.value!='') {
/* this will work regardless of the amount of space between values */
df[3].value=this.value.split(/\s+/)[0]; /* form element number 3 */
df[4].value=this.value.split(/\s+/)[1]; /* form element number 4 */
df[5].value=this.value.split(/\s+/)[2]; /* form element number 5 */
/*******************************************************************/
}
}
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>
<input type="text" value="foo"> <!-- form element number 0 -->
</div><div>
<input type="text" value="blah"> <!-- form element number 1 -->
</div><div>
<select name="myOptions"> <!-- form element number 2 -->
<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"> <!-- form element number 3 -->
</div><div>
<input type="text" name="showValue2"><!-- form element number 4 -->
</div><div>
<input type="text" name="showValue3"><!-- form element number 5 -->
</div><div>
<input type="submit"> <!-- form element number 6 -->
<input type="reset"> <!-- form element number 7 -->
</div>
</form>
</body>
</html>
<!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(){
document.theform.myOptions.onchange=function(){
if(this.value!='') {
/* this will work regardless of the amount of space between values */
document.theform.showValue1.value=this.value.split(/\s+/)[0];
document.theform.showValue2.value=this.value.split(/\s+/)[1];
document.theform.showValue3.value=this.value.split(/\s+/)[2];
/*******************************************************************/
}
}
document.theform.onsubmit=function(){
return CheckForm();
}
}
function CheckForm(){
}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
</script>
</head>
<body>
<form id="theform" name="theform" action="#">
<div>
<input type="text" name="foo" value="something else">
</div><div>
<input type="text" name="blah" value="something else">
</div><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="showValue1">
</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>
No problem, you're very welcome. ;)