Weergegeven resultaten: 1 t/m 3 van 3
  1. #1
    Member stelly's schermafbeelding
    Lid sinds
    19/03/03
    Locatie
    Galmaarden
    Berichten
    2.157
    iTrader
    0

    HTML/JS: Hoe radiobuttons controleren

    Hey,


    Ik gebruik javascript om het maken van een grote tabel met radiobuttons veel sneller te laten werken, ook naar updates toe. De bedoeling is aan de hand van die tabel om snel 3soorten code te genereren. Indien ik meer uitleg moet geven wat exact de output moet zijn kan ik het voort uitleggen maar ik vraag me vooral af op lijn 304 hoe ik kan nakijken welke buttons al dan niet zijn ingedrukt bij elk van de namen.

    Momenteel ben ik enkel op het onderdeel druid bezig om die code reeds te laten werken. Ik heb op lijn 304 al vele dingen geprobeerd maar telkens weigerde hij om die functie vervolgens uit te voeren.

    Moest iemand de tijd willen nemen om me voort te helpen zou je vreselijk bedankt zijn.


    Greets,
    Stijn

    Code:
    <html>
    <head><title>Invitelist setup</title>
    <style><!--
    .verticaltext {
    writing-mode: tb-rl;
    filter: flipv fliph;
    }
    --></style>
    
    
    
    <script type="text/javascript">
    	var druid = new Array(16);
    	var hunter = new Array(17);
    	var mage = new Array(25);
    	var paladin = new Array(19);
    	var priest = new Array(17);
    	var rogue = new Array(21);
    	var warlock = new Array(18);
    	var warrior = new Array(26);
    	var character = new Array(8);
    	var total = druid.length + hunter.length + mage.length + paladin.length + priest.length + rogue.length + warlock.length + warrior.length;
    
    	druid[0] = 'Alivia';
    	druid[1] = 'Cjagane';
    	druid[2] = 'Dicte';
    	druid[3] = 'Enver';
    	druid[4] = 'Fenixx';
    	druid[5] = 'Galed';
    	druid[6] = 'Jackhead';
    	druid[7] = 'Jirugi';
    	druid[8] = 'Loogasol';
    	druid[9] = 'Mejunior';
    	druid[10] = 'Menion';
    	druid[11] = 'Moesjasji';
    	druid[12] = 'Mymystery';
    	druid[13] = 'Psymeric';
    	druid[14] = 'Rizon';
    	druid[15] = 'Shadowfae';
    
    	hunter[0] = 'Aidina';
    	hunter[1] = 'Antares';
    	hunter[2] = 'Arti';
    	hunter[3] = 'Celuna';
    	hunter[4] = 'Clay';
    	hunter[5] = 'Coolbone';
    	hunter[6] = 'Dragonfang';
    	hunter[7] = 'Drigo';
    	hunter[8] = 'Forceonature';
    	hunter[9] = 'Gurnalf';
    	hunter[10] = 'Ogmamorigu';
    	hunter[11] = 'Pimos';
    	hunter[12] = 'Skymist';
    	hunter[13] = 'Torack';
    	hunter[14] = 'Valdar';
    	hunter[15] = 'Vanno';
    	hunter[16] = 'Xarin';
    
    	mage[0] = 'Anyanka';
    	mage[1] = 'Arang';
    	mage[2] = 'Arnogaaz';
    	mage[3] = 'Berglind';
    	mage[4] = 'Cauponor';
    	mage[5] = 'Drink';
    	mage[6] = 'Firesphinx';
    	mage[7] = 'Gelli';
    	mage[8] = 'Jamella';
    	mage[9] = 'Jigalo';
    	mage[10] = 'Killa';
    	mage[11] = 'Kimo';
    	mage[12] = 'Mayj';
    	mage[13] = 'Mevrouwke';
    	mage[14] = 'Mpd';
    	mage[15] = 'Noree';
    	mage[16] = 'Obor';
    	mage[17] = 'Oni';
    	mage[18] = 'Pacoznl';
    	mage[19] = 'Sigyn';
    	mage[20] = 'Speleding';
    	mage[21] = 'Themaster';
    	mage[22] = 'Walhalla';
    	mage[23] = 'Xantius';
    	mage[24] = 'Xazirri';
    
    	paladin[0] = 'Aden';
    	paladin[1] = 'Alric';
    	paladin[2] = 'Arms';
    	paladin[3] = 'Ascella';
    	paladin[4] = 'Bachus';
    	paladin[5] = 'Bernardus';
    	paladin[6] = 'Boelas';
    	paladin[7] = 'Dragonclaw';
    	paladin[8] = 'Dreadfoot';
    	paladin[9] = 'Duradell';
    	paladin[10] = 'Fluo';
    	paladin[11] = 'Jbke';
    	paladin[12] = 'Limus';
    	paladin[13] = 'Obilan';
    	paladin[14] = 'Pearlj';
    	paladin[15] = 'Silverke';
    	paladin[16] = 'Splidge';
    	paladin[17] = 'Theguy';
    	paladin[18] = 'Zalan';
    
    	priest[0] = 'Arachnia';
    	priest[1] = 'Clayke';
    	priest[2] = 'Crystalke';
    	priest[3] = 'Femme';
    	priest[4] = 'Fenikske';
    	priest[5] = 'Galadrial';
    	priest[6] = 'Ghlan';
    	priest[7] = 'Gulie';
    	priest[8] = 'Joselynn';
    	priest[9] = 'Moktok';
    	priest[10] = 'Nerwelle';
    	priest[11] = 'Raafje';
    	priest[12] = 'Starlite';
    	priest[13] = 'Torin';
    	priest[14] = 'Wrinex';
    	priest[15] = 'Zuigmarmot';
    	priest[16] = 'Zzoltan';
    
    	rogue[0] = 'Bliksem';
    	rogue[1] = 'Drincy';
    	rogue[2] = 'Fastolph';
    	rogue[3] = 'Flameweaver';
    	rogue[4] = 'Flavour';
    	rogue[5] = 'Gabriel';
    	rogue[6] = 'Glaysius';
    	rogue[7] = 'Gnoompie';
    	rogue[8] = 'Inz';
    	rogue[9] = 'Jaggred';
    	rogue[10] = 'Jedike';
    	rogue[11] = 'Krimson';
    	rogue[12] = 'Lecutus';
    	rogue[13] = 'Meander';
    	rogue[14] = 'Mecroid';
    	rogue[15] = 'Prozag';
    	rogue[16] = 'Schoe';
    	rogue[17] = 'Smedt';
    	rogue[18] = 'Snide';
    	rogue[19] = 'Thillio';
    	rogue[20] = 'Voox';
    
    	warlock[0] = 'Bosklapper';
    	warlock[1] = 'Frozenlock';
    	warlock[2] = 'Havlok';
    	warlock[3] = 'Heap';
    	warlock[4] = 'Lockylock';
    	warlock[5] = 'Lotus';
    	warlock[6] = 'Miany';
    	warlock[7] = 'Putteson';
    	warlock[8] = 'Ripkin';
    	warlock[9] = 'Sébastien';
    	warlock[10] = 'Shaolin';
    	warlock[11] = 'Targor';
    	warlock[12] = 'Velia';
    	warlock[13] = 'Warlockin';
    	warlock[14] = 'Wullf';
    	warlock[15] = 'Xantcha';
    	warlock[16] = 'Xark';
    	warlock[17] = 'Zaxara';
    
    	warrior[0] = 'Aldamir';
    	warrior[1] = 'Alelf';
    	warrior[2] = 'Comanche';
    	warrior[3] = 'Defsoul';
    	warrior[4] = 'Dogie';
    	warrior[5] = 'Fetch';
    	warrior[6] = 'Freakor';
    	warrior[7] = 'Grend';
    	warrior[8] = 'Hel';
    	warrior[9] = 'Jeroen';
    	warrior[10] = 'Jorona';
    	warrior[11] = 'Kayla';
    	warrior[12] = 'Kerremans';
    	warrior[13] = 'Mithril';
    	warrior[14] = 'Necmar';
    	warrior[15] = 'Neoreetj';
    	warrior[16] = 'Schtumpy';
    	warrior[17] = 'Smetje';
    	warrior[18] = 'Soldrin';
    	warrior[19] = 'Superturtle';
    	warrior[20] = 'Szadek';
    	warrior[21] = 'Tarballs';
    	warrior[22] = 'Thorgal';
    	warrior[23] = 'Tib';
    	warrior[24] = 'Tyara';
    	warrior[25] = 'Tyrando';
    
    	character[0] = 'Druid';
    	character[1] = 'Hunter';
    	character[2] = 'Mage';
    	character[3] = 'Paladin';
    	character[4] = 'Priest';
    	character[5] = 'Rogue';
    	character[6] = 'Warlock';
    	character[7] = 'Warrior';
    
    	function buildPage()
    	{
    		var out = '';
    		var i;
    		var number;
    
    		out += '<tr>';
    		for (i=0; i<8; i++)
    		{
    			out += '<td colspan="4">' + character[i] + '</td><td></td>';
    		}
    		out += '</tr><tr>';
    		for (i=0; i<8; i++)
    		{
    			out += '<td><div class="verticaltext">Invite</div></td><td><div class="verticaltext">Reserve</div></td><td><div class="verticaltext">Absent</div></td><td>Name</td><td></td>';
    		}
    		out += '</tr>';
    
    		for (i=0; i<26; i++)
    		{
    			number = i+1
    			out += '<tr>';
    			if (druid[i] != null) {
    				out += '<td><input type="radio" name="radiobutton' + druid[i] + '"></td><td><input type="radio" name="radiobutton' + druid[i] + '"></td><td><input type="radio" name="radiobutton' + druid[i] + '"></td><td>' + druid[i] + '</td>'
    			} else {
    				out += '<td colspan="4"></td>'
    			}
    			out += '<td>' + '</td>'
    			if (hunter[i] != null) {
    				out += '<td><input type="radio" name="' + hunter[i] + '" value="one"></td><td><input type="radio" name="' + hunter[i] + '" value="two"></td><td><input type="radio" name="' + hunter[i] + '" value="three" checked></td><td>' + hunter[i] + '</td>'
    			} else {
    				out += '<td colspan="4"></td>'
    			}
    			out += '<td>' + '</td>'
    			if (mage[i] != null) {
    				out += '<td><input type="radio" name="' + mage[i] + '" value="one"></td><td><input type="radio" name="' + mage[i] + '" value="two"></td><td><input type="radio" name="' + mage[i] + '" value="three" checked></td><td>' + mage[i] + '</td>'
    			} else {
    				out += '<td colspan="4"></td>'
    			}
    			out += '<td>' + '</td>'
    			if (paladin[i] != null) {
    				out += '<td><input type="radio" name="' + paladin[i] + '" value="one"></td><td><input type="radio" name="' + paladin[i] + '" value="two"></td><td><input type="radio" name="' + paladin[i] + '" value="three" checked></td><td>' + paladin[i] + '</td>'
    			} else {
    				out += '<td colspan="4"></td>'
    			}
    			out += '<td>' + '</td>'
    			if (priest[i] != null) {
    				out += '<td><input type="radio" name="' + priest[i] + '" value="one"></td><td><input type="radio" name="' + priest[i] + '" value="two"></td><td><input type="radio" name="' + priest[i] + '" value="three" checked></td><td>' + priest[i] + '</td>'
    			} else {
    				out += '<td colspan="4"></td>'
    			}
    			out += '<td>' + '</td>'
    			if (rogue[i] != null) {
    				out += '<td><input type="radio" name="' + rogue[i] + '" value="one"></td><td><input type="radio" name="' + rogue[i] + '" value="two"></td><td><input type="radio" name="' + rogue[i] + '" value="three" checked></td><td>' + rogue[i] + '</td>'
    			} else {
    				out += '<td colspan="4"></td>'
    			}
    			out += '<td>' + '</td>'
    			if (warlock[i] != null) {
    				out += '<td><input type="radio" name="' + warlock[i] + '" value="one"></td><td><input type="radio" name="' + warlock[i] + '" value="two"></td><td><input type="radio" name="' + warlock[i] + '" value="three" checked></td><td>' + warlock[i] + '</td>'
    			} else {
    				out += '<td colspan="4"></td>'
    			}
    			out += '<td>' + '</td>'
    			if (warrior[i] != null) {
    				out += '<td><input type="radio" name="' + warrior[i] + '" value="one"></td><td><input type="radio" name="' + warrior[i] + '" value="two"></td><td><input type="radio" name="' + warrior[i] + '" value="three" checked></td><td>' + warrior[i] + '</td>'
    			} else {
    				out += '<td colspan="4"></td>'
    			}
    			out += '</tr>';
    		}
    		document.write(out);
    	}
    
    	function printcode()
    	{
    		var buildOut = '';
    		buildOut += '-----------------------\n-- Start of userdata --\n-----------------------\n'
    
    
    		buildOut += 'function Invitelist_Primary()\n'
    		for (i=0; i<druid; i++)
    		{
    			
    		}
    		buildOut += 'end\n\n'
    
    
    		buildOut += 'function Invitelist_Reserve()\n'
    		buildOut += 'end\n\n'
    
    
    		buildOut += 'function Invitelist_All()\n'
    		buildOut += 'end\n\n'
    
    
    		buildOut += '---------------------\n-- End of userdata --\n---------------------\n'
    		document.invitelist.outputcode.value = buildOut;
    	}
    	function printprimary()
    	{
    		var buildOut = '';
    		for (i=0; i<druid.length; i++)
    		{
    		 		
    		}
    		document.invitelist.outputinvite.value = buildOut;
    	}
    	function printreserve()
    	{
    		var buildOut = 'reserve';
    		document.invitelist.outputreserve.value = buildOut;
    	}
    
    </script>
    </head>
    
    <body>
    <form name="invitelist">
    <h1>Invitelist setup</h1>
    <h4>1. Open this page</h4>
    <h4>2. Download and install <a href="" target="blank">Invitelist</a> if it is not installed yet.
    <h4>2. Fill in the form below.</h4>
    <table border="1">
    <script type="text/javascript">buildPage();</script>
    </table>
    <input type="button" name="Reset" value="Reset" onclick="location.reload()"></br></br>
    <table border ="1">
    <h4>3. Choose which list you want to make.</h4>
    <h4></h4>
    <tr><td><input type="button" value="Print code." onclick="printcode();"></br><textarea name="outputcode" rows="18" cols="30"></textarea><br>Generates code to invite ingame.</td>
    <td><input type="button" value="Print invitelist." onclick="printprimary();"></br><textarea name="outputinvite" rows="18" cols="30"></textarea><br>Makes a list to copy in macro's.</td>
    <td><input type="button" value="Print reservelist." onclick="printreserve();"></br><textarea name="outputreserve" rows="18" cols="30"></textarea><br>Makes a list to copy in macro's</td></tr>
    </table>
    <h4>4. If you want to use the list for a macro you can copy the middle or right outputted code into a macro ingame but the limit is 255charactars for a macro. If you want to use the add-on open the file Invitelist.lua in World of Warcraft/Interface/AddOns/Invitelist/</h4>
    <h4>5. Copy the code from the left box into this file. It is <b>CLEARLY</b> marked where the user data starts and ends. So overwrite the code between the start and end in the file with the code between the start and end in the left box. If you fail to do this, redownload the add-on and install the files again.</h4>
    <h4>6. Save and exit the file.</h4>
    <h4>7. Start World of Warcraft. You can now use the following commands ingame: "/invitelist primary" to invite all primary players, "/invitelist reserve" to invite all reserves and "/invitelist all" to invite both primary and reserve players in one list. There is also "/invitelist help" if you fail to remember the others codes.</h4>
    </body>
    </form>
    </html>

  2. #2
    Member servi's schermafbeelding
    Lid sinds
    1/07/02
    Locatie
    Zolder
    Berichten
    2.719
    iTrader
    6 (100%)
    het kan eens nuttig zijn om te vermelden wat er op lijn 304 staat + wat de verwachte uitvoer is.

    Niet iedereen is thuis in al dat MMORPG-gedoe hoor

  3. #3
    Member stelly's schermafbeelding
    Lid sinds
    19/03/03
    Locatie
    Galmaarden
    Berichten
    2.157
    iTrader
    0
    lijn 304 is normaal gezien de lege lijn in dit blok

    Code:
    	for (i=0; i<druid.length; i++)
    	{
    			
    	}
    	document.invitelist.outputinvite.value = buildOut;
    de uitvoer, in het middenste vak dus de functie printprimary() zou hij naar iedereen moeten zoeken waar invite staat aangeklikt en vervolgens een lijst afdrukken

    /invite PlayerA
    /invite PlayerB
    /invite PlayerC

    probleem ligt bij hoe een radiobutton checken aangezien oplossingen die ik op andere sites heb gevonden niet blijken te werken. Bij die oplossingen hebben ze hun radiobuttons in html aangemaakt en niet in javascript. Maar hier is het beter om de buttons met een script te maken om veel plaats te sparen dus vraag ik me af of hoe je hier dan naar de status van een radiobutton zoekt.

Discussie informatie

Users Browsing this Thread

Op dit moment bekijken 1 gebruikers deze discussie. (0 leden en 1 gasten)

Regels voor berichten

  • Je mag geen nieuwe discussies starten
  • Je mag niet reageren op berichten
  • Je mag geen bijlagen versturen
  • Je mag niet je berichten bewerken
  •