0

Hi,
Anyone know how to pass value from 1 javascript to another javascript?
I wanted to pass 1 of the variable in A.asp to B.asp variable. is it possible to do it?

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by strRusty_gal
0

In page a.asp you can keep one hidden form element, that will be passed to b.asp on submitting form. IN setvalue fuction you can set value for that field before submitting the form.

<script lang='javascript'>
function setvalue()
{
     document.getElementById('myfield ').value='newvalue';
     document.frm.submit();
}
</script>
<form name=frm action=b.asp method=post>
<input type=text name=txt1>
<input type=text name=txt2>
<input type=hidden name=myfield id=myfield value='somevalue'>
<input type=button name=txt1 onclick='javascript:setvalue()'>
</form>
0

In your b.asp code you may write

<%
dim txt1
txt1=Request.Form("txt1")
If txt1<>"" Then
      Response.Write("txt1=" & txt1)
End If
If Request.Form("txt1")<>"" Then
      Response.Write("txt2=" & Request.Form("txt1"))
End If

If Request.Form("myfield")<>"" Then
      Response.Write("myfield=" & Request.Form("myfield"))
End If
%>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.