pass values in web form

D

Dan Pavel

Hi,

I am new in programming and I have a problem. I must save a value in
database but i cannot pass the value from javascript to VB at strSQL
<%
Sub setare(cs)
If cs=1 Then
strSQL="UPDATE machines SET time=Stime WHERE ip='"&IP&"'"
Set rstDB = Server.CreateObject("ADODB.Recordset")
rstDB.Open strSQL, strConn
'rstDB.Close
'Set rstDB.ActiveConnection = Nothing
End If
End Sub
%>

<% If Len(IP)>4 Then %>
<font size=2>Display range </font><SELECT id="Select1" style="WIDTH:
40px" name="Select1" onchange="return Select1_onChange()">
<OPTION>1</OPTION>
<OPTION>2</OPTION>
<OPTION>3</OPTION>
<OPTION>4</OPTION>
</SELECT> hour(s)&nbsp;<INPUT TYPE="Button" NAME="cmdClickMe"
VALUE="Set">
<br>
<script language=javascript>
<!--
temp=<% =Dtime %>
Select1.selectedIndex = temp-1
//-->
</script>
<script id="clientEventHandlersJS" language="javascript">
<!--
function Select1_onChange() {
var c=Select1.selectedIndex
c=c+1
Stime=c
//alert(Stime)
}
//-->
</script>
<SCRIPT FOR="cmdClickMe" EVENT="onClick" LANGUAGE="VBscript">
Dim cc
cc=1
msgbox Stime
msgbox cc
<%
Dim cs
cs=1
setare(cs)
%>
msgbox ("OK")
</SCRIPT>


Please help.
Thank you
 
C

Chris

probably not the most eligante way, but I just have the javascript put the
value into a hidden textbox and access the textbox in VB to get the value.

Chris
 

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