In my ASP form I am passing some info to a third Party search tool using some javascript and asp.When I refresh the page again this code is executing.
I want this code to execute when the page is first loaded.
It should not execute on refresh.
Here is the code I wrote.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
<%@ language = VBScript%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>test</title>
<%
Dim strCategory
%>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="VBScript">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content=" <script language="javascript">
<script language="javascript">
function checkRefresh()
{
if (document.Form1.visited.visible="")
{
document.Form1.visited.value ="1";
}
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" onload="javascript:checkRefresh();">
<form id="Form1" method="post">
<input type="hidden" name="visited" id ="visited">
</form>
<% If not (Request.Form("visited")>0) then %>
<% '// if visited.value <>"" then %>
<% if (Request.QueryString) <> "" then %>
<% get_Category()%>
<% if len(Request.QueryString("sid"))>0 then %>
<script language="javascript">
roi_conversion ="<%=Request.QueryString("sid")%>";
roi_category = "<%=strCategory%>";
</script>
<% elseif len(Request.QueryString("sid"))=0 then %>
<script language="javascript">
roi_conversion ="0.00";
roi_category = "<%=strCategory%>";
</script>
<% end if %>
<% end if %>
<% end if%>
</body>
</HTML>
<%
Function get_Category()
Dim nsid
nsid = Request.QueryString("sid")
If nsid = 107 or nsid = 108 or nsid = 138 or nsid = 139 Then
strCategory = "Price Database"
Elseif nsid = 4 Then
strCategory = "Newsletter"
Elseif nsid = 132 Then
strCategory = "Market Alert"
Elseif nsid = 141 or nsid = 143 or nsid = 144 or nsid = 147 or nsid = 145 Then
strCategory = "Market Performance"
Elseif nsid = 1 Then
strCategory = "New User"
Else
strCategory = "Free Market Alert"
End If
End Function
%>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
In the above code I have created a hidden field(visited) and trying to pass the value to it. But I am getting error
"document.Form1.visited is null or Object not found" error
Some body help me.
I want this code to execute when the page is first loaded.
It should not execute on refresh.
Here is the code I wrote.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
<%@ language = VBScript%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>test</title>
<%
Dim strCategory
%>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="VBScript">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content=" <script language="javascript">
<script language="javascript">
function checkRefresh()
{
if (document.Form1.visited.visible="")
{
document.Form1.visited.value ="1";
}
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" onload="javascript:checkRefresh();">
<form id="Form1" method="post">
<input type="hidden" name="visited" id ="visited">
</form>
<% If not (Request.Form("visited")>0) then %>
<% '// if visited.value <>"" then %>
<% if (Request.QueryString) <> "" then %>
<% get_Category()%>
<% if len(Request.QueryString("sid"))>0 then %>
<script language="javascript">
roi_conversion ="<%=Request.QueryString("sid")%>";
roi_category = "<%=strCategory%>";
</script>
<% elseif len(Request.QueryString("sid"))=0 then %>
<script language="javascript">
roi_conversion ="0.00";
roi_category = "<%=strCategory%>";
</script>
<% end if %>
<% end if %>
<% end if%>
</body>
</HTML>
<%
Function get_Category()
Dim nsid
nsid = Request.QueryString("sid")
If nsid = 107 or nsid = 108 or nsid = 138 or nsid = 139 Then
strCategory = "Price Database"
Elseif nsid = 4 Then
strCategory = "Newsletter"
Elseif nsid = 132 Then
strCategory = "Market Alert"
Elseif nsid = 141 or nsid = 143 or nsid = 144 or nsid = 147 or nsid = 145 Then
strCategory = "Market Performance"
Elseif nsid = 1 Then
strCategory = "New User"
Else
strCategory = "Free Market Alert"
End If
End Function
%>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
In the above code I have created a hidden field(visited) and trying to pass the value to it. But I am getting error
"document.Form1.visited is null or Object not found" error
Some body help me.