field value based on dropdown

1

116

I am looking for some sample script for updating a textbox(s) based on a
dropdown value. Thanks in advance.

David
 
S

Steve Easton

116 said:
I am looking for some sample script for updating a textbox(s) based on a
dropdown value. Thanks in advance.

David

Copy and paste the texrt below my sig into a new "blank" page in code view,
then save and preview in browser and test it.
It will give you the basic idea.


--

Steve Easton
Microsoft MVP FrontPage
FP Cleaner
http://www.95isalive.com/fixes/fpclean.htm
Hit Me FP
http://www.95isalive.com/fixes/HitMeFP.htm


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Select a flower</title>
<script type="text/javascript">
var WhatToWrite;
function writeit(){
WhatToWrite = (setit.options[setit.selectedIndex].value);
document.getElementById("testing").innerHTML = WhatToWrite;
}
</script>
</head>

<body
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table1">
<tr>
<td width="50%">
<p align="center"><select name="pickone" id="setit" size="1">
<option>Select a flower</option>
<option value="Roses">Roses</option>
<option value="Orchids">Orchids</option>
<option value="Daisies">Daisies</option>
</select><input type="button" value="Go" onclick="writeit()"></p>
</td>
<td width="25%">
<p align="right">You selected:&nbsp; </p>
</td>
<td id="testing" width="25%" class="cell3">&nbsp; </td>
</tr>
</table>

</body>

</html>
 
1

116

Thanks Steve. This helped. Taking to the next step, can you point me in the
right direction for using Select Case? So based on combo value I can avoid
the typing.

Thanks
David

Steve Easton said:
116 said:
I am looking for some sample script for updating a textbox(s) based on a
dropdown value. Thanks in advance.

David

Copy and paste the texrt below my sig into a new "blank" page in code view,
then save and preview in browser and test it.
It will give you the basic idea.


--

Steve Easton
Microsoft MVP FrontPage
FP Cleaner
http://www.95isalive.com/fixes/fpclean.htm
Hit Me FP
http://www.95isalive.com/fixes/HitMeFP.htm


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Select a flower</title>
<script type="text/javascript">
var WhatToWrite;
function writeit(){
WhatToWrite = (setit.options[setit.selectedIndex].value);
document.getElementById("testing").innerHTML = WhatToWrite;
}
</script>
</head>

<body
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table1">
<tr>
<td width="50%">
<p align="center"><select name="pickone" id="setit" size="1">
<option>Select a flower</option>
<option value="Roses">Roses</option>
<option value="Orchids">Orchids</option>
<option value="Daisies">Daisies</option>
</select><input type="button" value="Go" onclick="writeit()"></p>
</td>
<td width="25%">
<p align="right">You selected: </p>
</td>
<td id="testing" width="25%" class="cell3"> </td>
</tr>
</table>

</body>

</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top