Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2005, 03:31 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help Debugging

I have the following code that I am using on several pages...

// create array of all quiz pages in the entire quiz
var quiz = new Array()
quiz[0] = new quizPage("pos_home.htm")
quiz[1] = new quizPage("pos_q1.htm")
quiz[2] = new quizPage("pos_q2.htm")
quiz[3] = new quizPage("pos_q3.htm")
quiz[4] = new quizPage("pos_q4.htm")
quiz[5] = new quizPage("pos_q5.htm")
quiz[6] = new quizPage("pos_q6.htm")
quiz[7] = new quizPage("pos_q7.htm")
quiz = new quizPage("pos_q8.htm")
quiz[9] = new quizPage("pos_q9.htm")
quiz[10] = new quizPage("pos_q10.htm")
quiz[11] = new quizPage("pos_sum.htm")
quiz[12] = new quizPage("../../quiz_menu.htm")

// navigate to next quiz page in sequence
function goNext() {
  var currPage, i
  for (i=0; i<(quiz.length-1); i++)
  {
   if (parent.main.location.href.indexOf(quiz[i].src) != -1)
        {
            if(i + 2 == quiz.length)
            {
                parent.window.location.href = quiz[quiz.length-1].src;
            }
            else
            {
                parent.main.location.href = quiz[i+1].src
                break
            }
        }
  }
}

What it does is provide navigation through a quiz. My problem is that this works perfectly everywhere I use it except in one area of my site. The code I posted above is the troublesome code. The only difference between this code and the code that qorks is the htm file names in the array.

The error I receive is

parent.main.location.href is null or not an object

Thoughts?

Clay Hess
__________________
Clay Hess
 
Old May 17th, 2005, 01:31 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Clay Hess,

Can you try to find out some differences in the two palces which you are using this code. I mean is the HTML layout of these two locations.

Regards
Ganesh
 
Old May 17th, 2005, 05:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Is the place where its not working within a frameset? And does that frameset also have a frame named 'main'?
 
Old May 17th, 2005, 10:13 AM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your suggestions. I had tried those. The good news is that I figured it out. The person who sent me these files to debug had used the reserved word 'location' as a variable.

Thanks again.

Clay Hess





Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging BSkelding VB.NET 2002/2003 Basics 1 June 16th, 2004 10:32 PM
Debugging Louisa VB.NET 2002/2003 Basics 1 March 18th, 2004 11:55 AM
debugging Adam H-W Classic ASP Basics 1 February 11th, 2004 02:30 PM
Need help debugging.... reg03 Beginning PHP 5 January 27th, 2004 03:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.