Redirect Problem

Results 1 to 3 of 3

Thread: Redirect Problem

  1. #1
    Join Date
    Dec 1969

    Default Redirect Problem

    I am using following script in my my call t.asp<BR>in script i am using if condition which says if pagenum=11 then <BR>redirect to "default.asp"<BR>else<BR>submit form1<BR>i set timer of 20 seconds when timer expires this script is called<BR>Problem is that when i load t.asp pagenum not equall to 11 but still script redirect page to default.asp<BR>Can some one help me <BR><BR>&#060;script Language="JavaScript"&#062;<BR>&#060;!--<BR>function startclock()<BR><BR>{<BR> pagenum = &#060;%=iPageCurrent+1%&#062;<BR> <BR> if (pagenum = 11)<BR> document.location.href="default.asp"<BR> else<BR> setTimeout(&#039;document.form1.submit()&#039;,200 00)<BR><BR> <BR>}<BR><BR><BR>//--&#062;<BR>&#060;/script&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Redirect Problem

    if (pagenum == 11){<BR>document.location.href="default.asp" <BR>}else{ <BR>setTimeout(&#039;document.form1.submit()&#039; ,20000) <BR>} <BR><BR><BR>

  3. #3
    Johnny Hughes Guest

    Default RE: Redirect Problem

    Adam,<BR><BR>You must use == vice = to test a conditional statment. Using only a single = will not work in javascript (for testing conditionals). A single = actually sets pagenum = 11 and always returns true ... which always loads your default page.<BR><BR>If you use == it will test the condition and leave the values set as they are... so this line:<BR><BR>if (pagenum = 11)<BR><BR>should be changed to this:<BR><BR>if (pagenum == 11)<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts