🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #50092

Problematyczna zmienna

#50092
From: Czesiu
Date: Sat, 29 May 2010 20:08
32 lines
1932 bytes
var good = 0;

function check(){
	var p = document.game.pierwsze.selectedIndex;
	var d = document.game.drugie.selectedIndex;
	var t = document.game.trzecie.selectedIndex;
	var cz = document.game.czwarte.selectedIndex;

	pierwsze = document.game.pierwsze.options[p].value;
	drugie = document.game.drugie.options[d].value;
	trzecie = document.game.trzecie.options[t].value;
	czwarte = document.game.czwarte.options[cz].value;

		if (pierwsze == true){
			good = good + 1
		}
		if (drugie == true){
			good = good + 1
		}
		if (trzecie == true){
			good = good + 1
		}
		if (czwarte == true){
			good = good +1
		}
			alert("Twój wynik " + good);
}

Witam!
W tym skrypcie mam taki problem że zmienna good cały czas wynosi zero
nie ważne czy jest zadeklarowana poza czy w funkcji nie mogę tego
zmienić. Jak to zrobić?
Technical Details
Message-ID: <be7e38a5-4973-45e0-abb5-2e98d5f9f4c1@o39g2000vbd.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!feeder.news-service.com!postnews.google.com!o39g2000vbd.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!feeder.news-service.com!postnews.google.com!o39g2000vbd.googlegroups.com!not-for-mail
From: Czesiu <tonyhouk@o2.pl>
Newsgroups: pl.comp.lang.javascript
Subject: Problematyczna zmienna
Date: Sat, 29 May 2010 13:08:45 -0700 (PDT)
Organization: http://groups.google.com
Lines: 32
Message-ID: <be7e38a5-4973-45e0-abb5-2e98d5f9f4c1@o39g2000vbd.googlegroups.com>
NNTP-Posting-Host: 83.21.202.13
Mime-Version: 1.0
X-Trace: posting.google.com 1275163725 6829 127.0.0.1 (29 May 2010 20:08:45 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 29 May 2010 20:08:45 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: o39g2000vbd.googlegroups.com; posting-host=83.21.202.13;  posting-account=IyKkLgoAAAC26yZr7z3wLXEsdrmFk2qZ
User-Agent: G2/1.0
X-HTTP-UserAgent: Opera/9.80 (Windows NT 6.1; U; pl) Presto/2.5.24  Version/10.53,gzip(gfe)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit