M
Matthew Ferri
I'm running Windows 2000 SP4 using Office 2000 SP3 to create a web page.
My goal is to use the selectedindex value from one drop-down list to compute
a value based upon the combination of multiple items as part of a data entry
form
Below are two program/script fragments from Q articles that highlight my
problem.
First is a program fragment from Q170495 that retrieves the value of the
dropdown menu item with the help of selectedindex. Unfortunately it is FP97
and I can not reproduce the functional equivalent of it with FP2000.
"FP97: Sample VBScript to Calculate Contents of Drop-Down Lists"
sub button1_onclick
' Create the form object.
dim theform
set theform = document.form1
' Return the value from the first drop-down menu.
' Drop-down text
' boxes return values as text.
' The Cint function converts text
' into an integer.
firstvalue = Cint(theform.drop1.options _
(theform.drop1.selectedindex).text)
secondvalue = Cint(theform.drop2.options _
(theform.drop2.selectedindex).text)
' Display the results in a text box.
theform.Text1.value = firstvalue + secondvalue
end sub
Second is a program fragment from Q197959.
"HOW TO: Use VBScript or JavaScript to Create Drop-Down Control
to Open Specific URL using FrontPage 2000"
<p>A drop down scripted URL list</p>
<form method="POST" name="SendMe">
<p><select name="DropIt" size="1">
<option> http://www.microsoft.com </option>
<option> http://www.msn.com </option>
<option> http://www.microsoft.com/frontpage </option>
<option> http://www.microsoft.com/support/frontpage </option>
</select> <input type="button" name="B1" value="Go">
<SCRIPT FOR="B1" EVENT="onClick" LANGUAGE="VBScript">
select case document.sendme.dropit.selectedindex
case 0
navigate("http://www.microsoft.com")
case 1
navigate("http://www.msn.com")
case 2
navigate("http://www.microsoft.com/frontpage")
case 3
navigate("http://www.microsoft.com/support/frontpage")
end select
</SCRIPT>
</form>
This second code fragment works perfectly within my web page so I know it
executes properly. I just want to add a line to assign the selectedindex
variable to a web page-wide variable that I can use in seperate item
calculations as shown in the first code example.
Every assignment statement I have tried will not capture the value of the
selectedindex variable to a web page wide variable I can use.
I just want to know if the value of ...selectedindex is 0 to 3.
For example,
Webpagewidevalue = document.sendme.dropit.selectedindex
Thanks in Advance,
Matthew
My goal is to use the selectedindex value from one drop-down list to compute
a value based upon the combination of multiple items as part of a data entry
form
Below are two program/script fragments from Q articles that highlight my
problem.
First is a program fragment from Q170495 that retrieves the value of the
dropdown menu item with the help of selectedindex. Unfortunately it is FP97
and I can not reproduce the functional equivalent of it with FP2000.
"FP97: Sample VBScript to Calculate Contents of Drop-Down Lists"
sub button1_onclick
' Create the form object.
dim theform
set theform = document.form1
' Return the value from the first drop-down menu.
' Drop-down text
' boxes return values as text.
' The Cint function converts text
' into an integer.
firstvalue = Cint(theform.drop1.options _
(theform.drop1.selectedindex).text)
secondvalue = Cint(theform.drop2.options _
(theform.drop2.selectedindex).text)
' Display the results in a text box.
theform.Text1.value = firstvalue + secondvalue
end sub
Second is a program fragment from Q197959.
"HOW TO: Use VBScript or JavaScript to Create Drop-Down Control
to Open Specific URL using FrontPage 2000"
<p>A drop down scripted URL list</p>
<form method="POST" name="SendMe">
<p><select name="DropIt" size="1">
<option> http://www.microsoft.com </option>
<option> http://www.msn.com </option>
<option> http://www.microsoft.com/frontpage </option>
<option> http://www.microsoft.com/support/frontpage </option>
</select> <input type="button" name="B1" value="Go">
<SCRIPT FOR="B1" EVENT="onClick" LANGUAGE="VBScript">
select case document.sendme.dropit.selectedindex
case 0
navigate("http://www.microsoft.com")
case 1
navigate("http://www.msn.com")
case 2
navigate("http://www.microsoft.com/frontpage")
case 3
navigate("http://www.microsoft.com/support/frontpage")
end select
</SCRIPT>
</form>
This second code fragment works perfectly within my web page so I know it
executes properly. I just want to add a line to assign the selectedindex
variable to a web page-wide variable that I can use in seperate item
calculations as shown in the first code example.
Every assignment statement I have tried will not capture the value of the
selectedindex variable to a web page wide variable I can use.
I just want to know if the value of ...selectedindex is 0 to 3.
For example,
Webpagewidevalue = document.sendme.dropit.selectedindex
Thanks in Advance,
Matthew