Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 11th, 2004, 02:38 PM
Friend of Wrox
 
Join Date: Apr 2004
Location: Wausau, WI, USA.
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default Confused on error

Could someone fill me in on why I get an error using the following code for navigation...

// constructor for a quiz page object
function quizPage(src,time, timeLimit, tries, score, completed) {
  this.src = src
  this.time = (!time) ? 0 : time
  this.timeLimit = (!timeLimit) ? 0 : timeLimit
  this.tries = (!tries) ? 0 : tries
  this.score = (!score) ? 0 : score
  this.completed = (!completed) ? false : completed
}

// create array of all quiz pages in the entire quiz
var quiz = new Array()


quiz[0] = new quizPage("al_home.htm")
quiz[1] = new quizPage("al_q1.htm")
quiz[2] = new quizPage("al_q2.htm")
quiz[3] = new quizPage("al_q3.htm")
quiz[4] = new quizPage("al_q4.htm")
quiz[5] = new quizPage("al_q5.htm")
quiz[6] = new quizPage("al_q6.htm")
quiz[7] = new quizPage("al_q7.htm")
quiz = new quizPage("al_q8.htm")
quiz[9] = new quizPage("al_q9.htm")
quiz[10] = new quizPage("al_q10.htm")
quiz[11] = new quizPage("al_sum.htm")
quiz[12] = new quizPage("al_home.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) {
      parent.main.location.href = quiz[i+1].src
      break
    }
  }
}


Once I navigate using the next button to the al_sum.htm page, when I click next to go back to the al_home.htm page I get

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

thoughts?

Clay Hess
__________________
Clay Hess
Reply With Quote
  #2 (permalink)  
Old June 18th, 2004, 03:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I tried location.href instead of parent.main.location.href, it works fine looping back to home and all the other pages in order.

Cheers!

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #3 (permalink)  
Old June 18th, 2004, 04:32 PM
Friend of Wrox
 
Join Date: Apr 2004
Location: Wausau, WI, USA.
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It does not work on mine and I don't understand how it would without knowing which frame to target. Any other thoughts?

Quote:
quote:Originally posted by happygv
 I tried location.href instead of parent.main.location.href, it works fine looping back to home and all the other pages in order.

Cheers!

_________________________
-Vijay G
Strive for Perfection
Clay Hess
Reply With Quote
  #4 (permalink)  
Old June 18th, 2004, 04:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Can you do an alert on parent.main.location.href's value before and after the line

parent.main.location.href = quiz[i+1].src;

to get some clue on that.

Actually, I didnot try that with FRAMES. So I tested that for any flaws in the goNext function, and there wasn't any.

Cheers!

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #5 (permalink)  
Old June 18th, 2004, 04:47 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Also it would be better, if you could explain about which frame is showing what and its names, which frame contains NEXT button/link and onClick of that, which frames shows the next quiz, etc... so as to suggest you different options.

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #6 (permalink)  
Old June 23rd, 2004, 11:53 AM
Friend of Wrox
 
Join Date: Apr 2004
Location: Wausau, WI, USA.
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the assist. SOme of it I have fixed, but now have a new issue. See the following post for details...

Code:
http://p2p.wrox.com/topic.asp?TOPIC_ID=14384


Quote:
quote:Originally posted by happygv
 Also it would be better, if you could explain about which frame is showing what and its names, which frame contains NEXT button/link and onClick of that, which frames shows the next quiz, etc... so as to suggest you different options.

_________________________
-Vijay G
Strive for Perfection
Clay Hess
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
confused mohabedalgani VB.NET 2002/2003 Basics 3 March 30th, 2005 11:48 PM
Confused about C# and Access baker_eliz C# 5 November 4th, 2004 05:03 PM
I'm Confused. Help!!! dangel75 General .NET 1 July 10th, 2004 09:54 AM



All times are GMT -4. The time now is 05:53 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.