Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsMobile ProgrammingMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 10th, 2000, 04:17 PM
zoordaan zoordaan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 1999
Posts: 9 zoordaan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 45 sec
Reputation Power: 0
I'm trying to figure out how to score a quizz using wmlscript. I have the correct/incorrect answer part working, I'm trying to create a function that keeps score by incrementing the value of a variable, I'm not sure what I'm doing wrong.

the script:

function addscore(){
var points;
points=points++;
return points;
}

extern function validateAnswer(Answer)
{
var validResponse = WMLBrowser.getVar("Answer");
if (validResponse != "value")
{
WMLBrowser.go("poll2.wml#NResults");
}
else
{
WMLBrowser.go("poll2.wml#YResults1");
var number = addscore();
WMLBrowser.setVar("score", number);
}
};

extern function validateAnswer2(Answer){
var validResponse = WMLBrowser.getVar("Answer");
if (validResponse != "value")
{
WMLBrowser.go("poll2.wml#NResults");
}
else
{
WMLBrowser.go("poll2.wml#YResults3");
var number = addscore();
WMLBrowser.setVar("score", number);
}
};

The card that's supposed to show the score:

<card id="YResults3" title="Results:">
<p>
Yes: Answer $(Answer) is correct "
</p>
<p>
Score: $(score) out of 3 "
</p>
<p>
<a href="poll2.wml#Trivia1">Start Over</a>
</p>
</card>

Reply With Quote
  #2  
Old October 18th, 2000, 11:16 AM
Dogg Dogg is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 9 Dogg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I would make sure of two things:

(1) That you have the correct initial value of points in the addscore function, and

(2) That you are calling the addscore function before you go to the YResults3 card.

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingMobile Programming > quizz with wmlscript

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap