<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="code.xsl" ?>
<dns5.nl>
<voorbeeld>
<title>yahtzee</title>
<verwijzende_link>http://www.dns5.nl/javascript/yahtzee.html</verwijzende_link>
<programma_code>
<![CDATA[
<!-- de code begint vanaf hier.

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
		<title>www.dns5.nl</title>
		<meta name='keywords' content="dns5" />
		<meta name='description' content="dns5.nl" />
		<meta name="author" content="Bobik">
		<meta name="language" content="nederlands">
		<style type="text/css" media="screen">
			body{color:#E5CC92;background:#002200;font-family:Helvetica,Geneva,Arial,SunSans-Regular,sans-serif;font-size:16px;}
			body a{text-decoration:none;}a{outline:none;}a img,img{border:none;}
			.tekst{color:#bbbbbb;background:#004400;text-align:center;padding-bottom:0.5em;}
			ul{margin-left:100px;display:block;width:16em;color:#82B282;background:#003300;padding:0.3em;list-style-type:none;border-right:1px solid #004000;border-top:1px solid #004000;}
			p{margin-left:100px;}p{margin-right:40%;}.css-check{display:none;}
			li a{color:#82B282;background:#003000;padding-left:0.5em;}
			li a:hover{color:#E5CC92;background:#003000;}
			.eenlink,.knop,.tekst{color:#aaaaaa;background:#004400;padding-left:0.5em;padding-right:0.5em;border-right:1px solid #005500;border-top:1px solid #005500;}
			.eenlink:hover,.knop:hover{color:#E5CC92;background:#004400;}
			.knop{color:#AABD8C;background:#004400;font-weight:bold;}
			.groter{font-size:1.4em;}
			.kleiner{font-size:0.7em;}
			.lager{margin-bottom:5em;}
			#logo{color:#436E00;background:#004400;position:absolute;right:1.2em;font-weight:bold;}
		</style>
		<style type="text/css" media="screen">
			a.naarboven{position:relative;top:-11px;left:8px;}
			table,td{border-collapse: collapse;margin-left:100px;color:inherit;background:#006600;}
			td{width:500px;}img{border:0px solid #006600;}.yahtzee{font-size:1.5em;color:#BABB00;background:#003800;}
		</style>
		<script type="text/javascript">
var waardestenen=[],freqs=["0","0","0","0","0","0","0"],multiply,number,loop,subloop,two,three,d=[],n=[],held,h,t,u,string_score,scores=[],held_dice=[],num_rolls=0,scored=false,num_scored=0;function reset_dice(){for(loop=0;loop<5;loop++){document.images['d'+loop].src="./images/db.gif";waardestenen[loop]=0;document.images['h'+loop].src="./images/hold.gif";held_dice[loop]=0;document.images.rolls.src="./images/sc0.gif";}}
function init(){if(num_rolls==3){num_rolls=0;}
for(loop=0;loop<17;loop++){scores[loop]=-1;document.images['sc'+loop+'h'].src="./images/scb.gif";document.images['sc'+loop+'t'].src="./images/scb.gif";document.images['sc'+loop+'u'].src="./images/scb.gif";}
reset_dice();d=new Date();document.hs.date.value=d.toGMTString();document.hs.id.value=Math.random();}
function load_images(){for(loop=0;loop<10;loop++){n[loop]=new Image();n[loop].src="./images/sc"+loop+".gif";if(loop>0&&loop<7){d[loop]=new Image();d[loop].src="./images/d"+loop+".gif";}}
held=new Image();held.src="./images/held.gif";}
function set_scores(){for(loop=0;loop<17;loop++){if(scores[loop]<0){continue;}
string_score=scores[loop]+"x";if(string_score.length==4){h=string_score.substring(0,1);t=string_score.substring(1,2);u=string_score.substring(2,3);}else if(string_score.length==3){h="b";t=string_score.substring(0,1);u=string_score.substring(1,2);}else{h="b";t="b";u=string_score.substring(0,1);}
document.images['sc'+loop+'h'].src="./images/sc"+h+".gif";document.images['sc'+loop+'t'].src="./images/sc"+t+".gif";document.images['sc'+loop+'u'].src="./images/sc"+u+".gif";}}
function roll(){if(num_rolls==4){num_rolls=3;window.alert("klik op nieuw spel");return;}if(num_rolls==3){return;}
num_rolls++;document.images.rolls.src="./images/sc"+num_rolls+".gif";scored=false;freqs=["0","0","0","0","0","0","0"];for(loop=0;loop<5;loop++){if(held_dice[loop]!=1){number=Math.round(Math.random()*6+0.5);document.images['d'+loop].src="./images/d"+number+".gif";waardestenen[loop]=number;}
freqs[waardestenen[loop]]++;}}
function score(opt,num,ref){if(scored||scores[ref]>-1){return;}
scored=true;scores[ref]=0;num_rolls=0;if(opt=='nums'){scores[ref]=num*freqs[num];}
if(opt=='kind'){for(loop=1;loop<7;loop++){if(freqs[loop]>=num){if(num<5){for(subloop=0;subloop<5;subloop++){scores[ref]+=waardestenen[subloop];}}else{scores[ref]=50;}
break;}}}
if(opt=='full'){two=false;three=false;for(loop=1;loop<7;loop++){if(freqs[loop]==2){two=true;}
if(freqs[loop]==3){three=true;}}
if(two&&three){scores[ref]=25;}}
if(opt=='straight'){for(loop=1;loop<8-num;loop++){multiply=1;for(subloop=loop;subloop<loop+num;subloop++){multiply*=freqs[subloop];if(multiply===0){break;}}
if(multiply!==0){scores[ref]=(num-1)*10;break;}}}
if(opt=='chance'){for(loop=0;loop<5;loop++){scores[ref]+=waardestenen[loop];}}
scores[7]=0;scores[15]=0;scores[16]=0;for(loop=0;loop<6;loop++){if(scores[loop]>-1){scores[7]+=scores[loop];}}
if(scores[7]>62){scores[7]+=35;document.images.sc6t.src="./images/sc3.gif";document.images.sc6u.src="./images/sc5.gif";}
for(loop=8;loop<15;loop++){if(scores[loop]>-1){scores[15]+=scores[loop];}}
scores[16]=scores[7]+scores[15];set_scores();reset_dice();num_scored++;if(num_scored==13){window.alert("Jouw score is "+scores[16]);num_rolls=3;}}
function hold(num){if(waardestenen[num]<0){return;}
if(held_dice[num]==1){held_dice[num]=0;document.images['h'+num].src="./images/hold.gif";}else{held_dice[num]=1;document.images['h'+num].src="./images/held.gif";}}
		</script>
	</head>
	<body>
		<div class="tekst">			
			<div id="logo">www.dns5.nl</div>
			<span class="groter"><strong>yahtzee</strong></span><br />
			<span class="kleiner"><strong>een valide javascript</strong></span>
		</div>
		<p class="lager">
			<a href="http://www.dns5.nl/" rel="nofollow" title=" hoofd pagina "><span class="knop">home</span></a>

			<a href="http://www.dns5.nl/alle-scripts-en-code.html" rel="nofollow" title=" hoofd-menu "><span class="knop">menu</span></a>
			<a href="http://www.dns5.nl/help.html" rel="nofollow" title=" help "><span class="knop">help</span></a>
		</p>
		<p class="css-check">
			Er is geen CSS ondersteuning. 
			Zonder CSS is alleen de onopgemaakte HTML zichtbaar.
		</p>
		<noscript>
			<p>
				Jouw javascript is uitgeschakeld.
				Sommige onderdelen van deze site
				die javascript gebruiken zijn nu
				niet operationeel.
			</p>
		</noscript>
		<ul>
			<li><a href="http://www.dns5.nl/javascript/" title=" javascript menu ">klik hier voor het javascript-menu</a></li>
			<li><a href="http://www.dns5.nl/javascript/programma-code/yahtzee.xml" rel="nofollow,noindex" title=" de broncode voor de pagina ">klik hier voor de broncode</a></li>
		</ul>
		<pre>
		</pre>
		<table>
			<tr>
				<td>
				<img src="images/yahtzee.gif" width=25 height=80>
				<a href="javascript:hold(0)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=40 id="d0" ></a>
				<a href="javascript:hold(1)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=40 id="d1" ></a>
				<a href="javascript:hold(2)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=40 id="d2" ></a>
				<a href="javascript:hold(3)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=40 id="d3" ></a>
				<a href="javascript:hold(4)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=40 id="d4" ></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:init()"><span class="eenlink">NIEUW SPEL</span>&nbsp;&nbsp;&nbsp;&nbsp;</a>
				<br /><img src="images/yahtzee.gif" width=25 height=1>
				<a href="javascript:hold(0)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=17  id="h0"></a>
				<a href="javascript:hold(1)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=17  id="h1"></a>
				<a href="javascript:hold(2)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=17  id="h2"></a>
				<a href="javascript:hold(3)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=17  id="h3"></a>
				<a href="javascript:hold(4)" onMouseOver="window.status='';return true;"><img src="images/yahtzee.gif" width=41 height=17  id="h4"></a>
				<br /><br />
				<img src="images/yahtzee.gif" width=200 height=1>
				<a  href="javascript:roll()"><span class="eenlink"><span class="yahtzee">GOOIEN</span></span></a>
				<img src="images/yahtzee.gif" width=20 height=1>
				<img src="images/yahtzee.gif" width=11 height=25 id="rolls">
				<br /><br />
				<table>
					<tr>
					<td>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc0h"><img src="images/yahtzee.gif" width=11 height=25 id="sc0t"><img src="images/yahtzee.gif" width=11 height=25 id="sc0u"><a class="naarboven" href="javascript:score('nums',1,0)"><span class="eenlink">eentjes</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc1h"><img src="images/yahtzee.gif" width=11 height=25 id="sc1t"><img src="images/yahtzee.gif" width=11 height=25 id="sc1u"><a class="naarboven" href="javascript:score('nums',2,1)"><span class="eenlink">tweetjes</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc2h"><img src="images/yahtzee.gif" width=11 height=25 id="sc2t"><img src="images/yahtzee.gif" width=11 height=25 id="sc2u"><a class="naarboven" href="javascript:score('nums',3,2)"><span class="eenlink">drietjes</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc3h"><img src="images/yahtzee.gif" width=11 height=25 id="sc3t"><img src="images/yahtzee.gif" width=11 height=25 id="sc3u"><a class="naarboven" href="javascript:score('nums',4,3)"><span class="eenlink">viertjes</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc4h"><img src="images/yahtzee.gif" width=11 height=25 id="sc4t"><img src="images/yahtzee.gif" width=11 height=25 id="sc4u"><a class="naarboven" href="javascript:score('nums',5,4)"><span class="eenlink">vijfjes</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc5h"><img src="images/yahtzee.gif" width=11 height=25 id="sc5t"><img src="images/yahtzee.gif" width=11 height=25 id="sc5u"><a class="naarboven" href="javascript:score('nums',6,5)"><span class="eenlink">zesjes</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc6h"><img src="images/yahtzee.gif" width=11 height=25 id="sc6t"><img src="images/yahtzee.gif" width=11 height=25 id="sc6u"><a class="naarboven" href="javascript:score('nums',1,0)"><span class="eenlink">bonus</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc7h"><img src="images/yahtzee.gif" width=11 height=25 id="sc7t"><img src="images/yahtzee.gif" width=11 height=25 id="sc7u"><a class="naarboven" href="javascript:score('nums',1,0)"><span class="eenlink">sub-totaal</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc16h"><img src="images/yahtzee.gif" width=11 height=25 id="sc16t"><img src="images/yahtzee.gif" width=11 height=25 id="sc16u"><a class="naarboven" href="javascript:score('nums',1,0)"><span class="eenlink">totaal</span></a>
					</td>
					<td>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					</td>
					<td>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc8h"><img src="images/yahtzee.gif" width=11 height=25 id="sc8t"><img src="images/yahtzee.gif" width=11 height=25 id="sc8u"><a class="naarboven" href="javascript:score('kind',3,8)"><span class="eenlink">3ofakind</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc9h"><img src="images/yahtzee.gif" width=11 height=25 id="sc9t"><img src="images/yahtzee.gif" width=11 height=25 id="sc9u"><a class="naarboven" href="javascript:score('kind',4,9)"><span class="eenlink">4ofakind</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc10h"><img src="images/yahtzee.gif" width=11 height=25 id="sc10t"><img src="images/yahtzee.gif" width=11 height=25 id="sc10u"><a class="naarboven" href="javascript:score('full',0,10)"><span class="eenlink">fullhouse</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc11h"><img src="images/yahtzee.gif" width=11 height=25 id="sc11t"><img src="images/yahtzee.gif" width=11 height=25 id="sc11u"><a class="naarboven" href="javascript:score('straight',4,11)"><span class="eenlink">kleinestraat</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc12h"><img src="images/yahtzee.gif" width=11 height=25 id="sc12t"><img src="images/yahtzee.gif" width=11 height=25 id="sc12u"><a class="naarboven" href="javascript:score('straight',5,12)"><span class="eenlink">grotestraat</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc13h"><img src="images/yahtzee.gif" width=11 height=25 id="sc13t"><img src="images/yahtzee.gif" width=11 height=25 id="sc13u"><a class="naarboven" href="javascript:score('kind',5,13)"><span class="eenlink">yahtzee</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc14h"><img src="images/yahtzee.gif" width=11 height=25 id="sc14t"><img src="images/yahtzee.gif" width=11 height=25 id="sc14u"><a class="naarboven" href="javascript:score('chance',0,14)"><span class="eenlink">kans</span></a><br>
					<img src="images/yahtzee.gif" width=11 height=25 id="sc15h"><img src="images/yahtzee.gif" width=11 height=25 id="sc15t"><img src="images/yahtzee.gif" width=11 height=25 id="sc15u"><a class="naarboven"><span class="eenlink">sub-totaal</span></a><br>
					</td>
					</tr>
				</table>
				</td>
				</tr>
				<tr>
				 <td>
				</td>
			</tr>
		</table>
		<form name="hs" action="" method=post>
			<input type="hidden" name="date">
			<input type="hidden" name="score">
		</form>
		<script type="text/javascript">num_rolls=4;</script>
		<pre>
		</pre>
		<p>
			Voor mij hoef je Yahtzee niet op jouw website te zetten. 
			Je kan ook gewoon hier af en toe even het spelletje spelen. 
			Er valt heel weinig over te vertellen. De javascript-code is 
			valide, evenals de css en de html5. Je kan als je wilt de 
			broncode downloaden en op jouw webruimte plaatsen. Er is verder 
			niets in te stellen. De plaatjes die er bij horen zitten in <a href="http://www.dns5.nl/javascript/download-yahtzee.php" rel="nofollow,noindex"  title=" download yahtzee "><span class="eenlink">deze</span></a> 
			zipfile.
		</p>
		<pre>

		</pre>
	</body>
</html>

de code is hier geeindigd.
// -->
]]>
</programma_code>
</voorbeeld>
</dns5.nl>
