TLMM
08-27-2003, 10:19 AM
I am creating a web site that has several sections. Some sections were long, so I created next and previous buttons to move to the next part of the section. This is all done on the same page and I use case statements to determine which text appears when the next or previous is clicked. It works prefect in IE, but I just tried it in Netscape 7.1 and it won't work. It will not move to the next page. Below is an example of my code. It anyone can help, it would be greatly appreciated. I have to have this completed in the next week. Thanks.
These are the next and previous functions:
<SCRIPT LANGUAGE="javascript">
<!--
//Move Previous
function OnMovePrevious()
{
var lngAbsolutePosition
if (document.all["txtHiddenImpactPageNum"].value=="1")
{
return false;
}
lngAbsolutePosition=(document.all["txtHiddenImpactPageNum"].value * 1) - 1;
//Set the hidden textbox to pass across on the submit of the page
document.all["txtHiddenImpactPageNum"].value = lngAbsolutePosition;
//********Change the form name here if you change it in the form tag.******************
document.all["frmImpact"].submit();
return false;
}
//Move Next
function OnMoveNext()
{
var lngAbsolutePosition
// ******** IMPORTANT: YOU MUST SET THE LAST PAGE HERE INTO THE lngLastPage VARIABLE. ******************
var lngLastPage = "2";
lngAbsolutePosition=(document.all["txtHiddenImpactPageNum"].value * 1) + 1;
if (lngAbsolutePosition > (lngLastPage * 1))
{
return false;
}
document.all["txtHiddenImpactPageNum"].value = lngAbsolutePosition;
//********Change the form name here if you change it in the form tag.******************
document.all["frmImpact"].submit();
return false;
}
This is the code to set the variable:
<%@ Language=VBScript %>
<%Option Explicit%>
<%
Dim strImpactPageNum
strImpactPageNum = Request.Form("txtHiddenImpactPageNum")
'If this page is not submitting to itself, then it must be the first page
if IsEmpty(strImpactPageNum) then
strImpactPageNum = 1
end if
%>
This is sample code from one of the case statements:
<%Select Case UCASE(strImpactPageNum) 'Checking to see which page to build%>
<%Case 1 'Build Page 1 %> CODE........
<form name="frmImpact" action="Impact.asp" method="Post">
<font face="Tahoma" size="1" color="#000000"><b> 1</b></font>
<font face="Tahoma" size="1" color="#C85E00"><b>2</b></font>
<%
Dim a
For a = 1 to 23
%>
<%
next
%>
<a href onclick="return OnMoveNext()" style="text-decoration: none"><font face="Tahoma" size="1" color="#C85E00"><b>next
> ></b></font></a>
<!--Create a hidden textbox to hold the value of the page-->
<input type="hidden" name="txtHiddenImpactPageNum" value="<%=strImpactPageNum%>">
</form>
Other cases...
<%End Select%>
Thanks in advance to anyone who can help.
These are the next and previous functions:
<SCRIPT LANGUAGE="javascript">
<!--
//Move Previous
function OnMovePrevious()
{
var lngAbsolutePosition
if (document.all["txtHiddenImpactPageNum"].value=="1")
{
return false;
}
lngAbsolutePosition=(document.all["txtHiddenImpactPageNum"].value * 1) - 1;
//Set the hidden textbox to pass across on the submit of the page
document.all["txtHiddenImpactPageNum"].value = lngAbsolutePosition;
//********Change the form name here if you change it in the form tag.******************
document.all["frmImpact"].submit();
return false;
}
//Move Next
function OnMoveNext()
{
var lngAbsolutePosition
// ******** IMPORTANT: YOU MUST SET THE LAST PAGE HERE INTO THE lngLastPage VARIABLE. ******************
var lngLastPage = "2";
lngAbsolutePosition=(document.all["txtHiddenImpactPageNum"].value * 1) + 1;
if (lngAbsolutePosition > (lngLastPage * 1))
{
return false;
}
document.all["txtHiddenImpactPageNum"].value = lngAbsolutePosition;
//********Change the form name here if you change it in the form tag.******************
document.all["frmImpact"].submit();
return false;
}
This is the code to set the variable:
<%@ Language=VBScript %>
<%Option Explicit%>
<%
Dim strImpactPageNum
strImpactPageNum = Request.Form("txtHiddenImpactPageNum")
'If this page is not submitting to itself, then it must be the first page
if IsEmpty(strImpactPageNum) then
strImpactPageNum = 1
end if
%>
This is sample code from one of the case statements:
<%Select Case UCASE(strImpactPageNum) 'Checking to see which page to build%>
<%Case 1 'Build Page 1 %> CODE........
<form name="frmImpact" action="Impact.asp" method="Post">
<font face="Tahoma" size="1" color="#000000"><b> 1</b></font>
<font face="Tahoma" size="1" color="#C85E00"><b>2</b></font>
<%
Dim a
For a = 1 to 23
%>
<%
next
%>
<a href onclick="return OnMoveNext()" style="text-decoration: none"><font face="Tahoma" size="1" color="#C85E00"><b>next
> ></b></font></a>
<!--Create a hidden textbox to hold the value of the page-->
<input type="hidden" name="txtHiddenImpactPageNum" value="<%=strImpactPageNum%>">
</form>
Other cases...
<%End Select%>
Thanks in advance to anyone who can help.