|
 |
asp_web_howto thread: javascript variables
Message #1 by "Linda L. Warren-Williams" <llwarrenwilliams@y...> on Thu, 22 Feb 2001 13:27:48
|
|
I need help in assigning a value of a javascript variable to a vbscript
variable for comparison.
For example:
<SCRIPT LANGUAGE="JavaScript">
function display(thisValue,make)
{
var selvalue;
var noption;
noption = 0;
selvalue = document.forms[0].cpccoffice.options[document.forms
[0].cpccoffice.selectedIndex].value;
document.forms[0].cpccCostcenter.length = 0;
alert (selvalue);
alert ( document.forms[0].cpccCostcenter.length);
<%
dim conn,sql,rst,myconn,stroffice
stroffice =selvalue 'I want the variable (stroffice to be equal to the
value of selvalue.
sql = "Select costcenter from dbo.view_OfficeCostCtrName WHERE
office=" & stroffice
%>
alert("<%=stroffice%>");
}
</SCRIPT>
Message #2 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Thu, 22 Feb 2001 14:25:05 -0000
|
|
you have to submit the form to the asp and retreive the variable from the
request object, no other way it can be done.
You might want to rethink your application logic though... maybe break your
form up into seperate pages (like a wizard) so that you can retreive the
value before proceding to the next step.
-----Original Message-----
From: Linda L. Warren-Williams [mailto:llwarrenwilliams@y...]
Sent: Thursday, February 22, 2001 10:10 PM
To: ASP Web HowTo
Subject: [asp_web_howto] javascript variables
I need help in assigning a value of a javascript variable to a vbscript
variable for comparison.
For example:
<SCRIPT LANGUAGE="JavaScript">
function display(thisValue,make)
{
var selvalue;
var noption;
noption = 0;
selvalue = document.forms[0].cpccoffice.options[document.forms
[0].cpccoffice.selectedIndex].value;
document.forms[0].cpccCostcenter.length = 0;
alert (selvalue);
alert ( document.forms[0].cpccCostcenter.length);
<%
dim conn,sql,rst,myconn,stroffice
stroffice =selvalue 'I want the variable (stroffice to be equal to the
value of selvalue.
sql = "Select costcenter from dbo.view_OfficeCostCtrName WHERE
office=" & stroffice
%>
alert("<%=stroffice%>");
}
</SCRIPT>
______________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
|
|
 |