Hi ! I need someone to help me with this.
I have an ASP page with a form that sends two values coming from a textbox to other. What i need is: A second page must receive them and pass them as parameters of a .JS function, who performs a sum and returns the result to it, which shows the value in an alert message.
I don't really understand how to manage a Js inside VBScript or how is the best way to do it, this code is the only way i could solve it.
I test my Js passing fixed numeric values and works fine, but as it is requested in my code, the alert message shows "NaN"
I'll appreciate your suggestions! Thks!!
---------------------------------------------
ASP PAGE WHICH RECEIVES THE VALUES
---------------------------------------------
<SCRIPT>
var primero
</SCRIPT>
<SCRIPT>
var segundo
</SCRIPT>
<%@LANGUAGE="Ja vaScript"%>
<%
primero = new String(Request. Form("uno"))
segundo = new String(Request. Form("dos"))
%>
<html>
<head>
<script src="sumamos.js " language="javas cript">
</script>
</head>
<body>
<script language="javaS cript">
var total
total = suma (primero, segundo)
alert(total)
</script>
</body>
</html>
------------------
EXTERNAL JS
-------------------
function suma (uno, dos)
{
suma = (eval(uno) + eval(dos))
return suma
}
I have an ASP page with a form that sends two values coming from a textbox to other. What i need is: A second page must receive them and pass them as parameters of a .JS function, who performs a sum and returns the result to it, which shows the value in an alert message.
I don't really understand how to manage a Js inside VBScript or how is the best way to do it, this code is the only way i could solve it.
I test my Js passing fixed numeric values and works fine, but as it is requested in my code, the alert message shows "NaN"
I'll appreciate your suggestions! Thks!!
---------------------------------------------
ASP PAGE WHICH RECEIVES THE VALUES
---------------------------------------------
<SCRIPT>
var primero
</SCRIPT>
<SCRIPT>
var segundo
</SCRIPT>
<%@LANGUAGE="Ja vaScript"%>
<%
primero = new String(Request. Form("uno"))
segundo = new String(Request. Form("dos"))
%>
<html>
<head>
<script src="sumamos.js " language="javas cript">
</script>
</head>
<body>
<script language="javaS cript">
var total
total = suma (primero, segundo)
alert(total)
</script>
</body>
</html>
------------------
EXTERNAL JS
-------------------
function suma (uno, dos)
{
suma = (eval(uno) + eval(dos))
return suma
}
Comment