Click to See Complete Forum and Search --> : using jscript variables inside asp


mshaqalaih
08-28-2003, 02:50 AM
<SCRIPT LANGUAGE=javascript>
<!--
function calculate(row,obj,zmark,stdno,subno)
{
var sum = 0
var fmark = parseInt(document.myform.final_mark(row-1).value,10)
var smark = parseInt(document.myform.smtr_mark(row-1).value,10)
var stmark = document.myform.student_mark(row-1).value
if (stmark == 12)
return false;
if (row >= 1)
{
formobj = this.form
val = obj.value
if(isNaN(val))
{
alert("تأكد من القيمة المدخلة")
obj.select()
obj.focus()
obj.value = ''
}
else
{
if (smark == 200){
smark = 0
}
sum = fmark + smark
if (sum > 100)
{
alert("علامة الطالب يجب أن تكون أقل أو يساوي 100")
obj.value = ''
obj.select()
obj.focus()
return false;
}
else if(1==1)
{
if (isNaN(sum)||sum < zmark)
document.myform.student_mark(row-1).value = zmark
else
{
document.myform.student_mark(row-1).value = sum
<%
var Connection = Server.CreateObject("ADODB.Connection");
Connection.open="DRIVER={Microsoft ODBC for Oracle};SERVER=iug;UID=username;PWD=password";
var Data = Server.CreateObject("ADODB.Command");
Data.ActiveConnection =Connection;
(*) Data.CommandText ="update student_subject_temp set student_mark = 1 where student_no = 2 and sub_no = 3 and semester_no = 20031";
Data.execute;
%>
}
if (obj.name == "final_mark")
document.myform.smtr_mark(row).focus()
}
}
}
}
-->
</SCRIPT>
My question is :
//see the marked line (with *)
((*) Data.CommandText ="update student_subject_temp set student_mark = 1 where student_no = 2 and sub_no = 3 ";
)
i want to replace 1 with "sum" variable and 2 with "stdno" variable and 3 with "subno" variable.I want to do my update without submit the page.
if i can do that,how can i do that???

mshaqalaih
08-30-2003, 07:40 AM
is there any answer????:( :(

Superfly1611
09-02-2003, 02:47 AM
To my knowledge you cant use JScript variables inside ASP because the ASP is processed on the Server at run time and by the time the JScript is executed there are no ASP variables to use as by the time it gets to the client it has all been generated into HTML.