Assign a variable to a text box

W

Wayne-I-M

Hi All

Is it possible in FP to assign a variable?

If you have a drop down box with 3 options
<option>ABC</option>
<option>DEF</option>
<option>GHI</option>

If the 1st option (ABC) then you could set the value of a text box to 123
If the 2nd option (DEF) then you could set the value of a text box to 456
If the 3rd option (GHI) then you could set the value of a text box to 789

Many thanks
 
S

Steve Easton

Here's a sample that writes to a cell.
modify as necessary.

<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>


--

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

Wayne-I-M

Hi Steve

Thanks for your answer I changed it a little to
<option value="123">ABC</option>
<option value="456">DEF</option>
<option value="789">GHI</option>

and it works really well for what I want.

Thanks for your time. I hope you had a really good Christmas and will have
a great New Year.


--
Wayne
Manchester, England.



Steve Easton said:
Here's a sample that writes to a cell.
modify as necessary.

<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>


--

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

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