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?

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';
<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()'>
Member Avatar

You can also use cookies, this is one of the things they are for.

urtrivedi, How do i get the value from b.asp?
Thanks for the help =)

In your b.asp code you may write

dim 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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.