Vebers Posted September 17, 2005 Report Share Posted September 17, 2005 Inbox'ā ir tāda iespēja ka var ieķeksējot vienu checkbox ieķeksējas visi checkboxi. Mans jautājums: Kā lai panāk šo efektu? No javascript es neko nesaprotu :( Skatījos kā inboxā taisīts, it kā nokopēju to funkciju select_all(this), bet k-kas nestrādāja... Varbūt ir kāds tutoriālis par to aprasktīts ? šeit forumā arī neko neatradu... Link to comment Share on other sites More sharing options...
Vebers Posted September 17, 2005 Author Report Share Posted September 17, 2005 njaa.. google ir mans draugs :) atradu šādu skriptu : <!-- TWO STEPS TO INSTALL CHECK ALL: 1. Copy the coding into the HEAD of your HTML document 2. Add the last code into the BODY of your HTML document --> <!-- STEP ONE: Paste this code into the HEAD of your HTML document --> <HEAD> <script LANGUAGE="JavaScript"> <!-- Modified By: Steve Robison, Jr. (stevejr@ce.net) --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } } // End --> </script> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <center> <form name=myform action="" method=post> <table> <tr><td> <b>Your Favorite Scripts & Languages</b><br> <input type=checkbox name=list value="1">Java<br> <input type=checkbox name=list value="2">JavaScript<br> <input type=checkbox name=list value="3">ASP<br> <input type=checkbox name=list value="4">HTML<br> <input type=checkbox name=list value="5">SQL<br> <br> <input type=button value="Check All" onClick="this.value=check(this.form.list)"> </td></tr> </table> </form> </center> <p><center> <font face="arial, helvetica" size="-2">Free JavaScripts provided<br> by <a href="http://javascriptsource.com">The JavaScript Source</a></font> </center><p> <!-- Script Size: 1.47 KB --> Bet problēma tāda ka neko no šī skripta nesaprotu varbūt ir kāds labs lv tutoriālis par javascript ? Link to comment Share on other sites More sharing options...
Paulinjsh Posted September 17, 2005 Report Share Posted September 17, 2005 Bet problēma tāda ka neko no šī skripta nesaprotu varbūt ir kāds labs lv tutoriālis par javascript ? Nu latviski ir pagrūti kko atrast un labā kvalitātē! Iesaku sameklēt un nokačāt "java script: The Definitive Guide, 4th Edition By David Flanagan" laba grāmata :) Link to comment Share on other sites More sharing options...
Kaklz Posted September 20, 2005 Report Share Posted September 20, 2005 Es daru šādi: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <script type="text/javascript"> function checkall(){ inputs = document.getElementsByTagName('input'); state = document.getElementById('chboxstate').checked for (i = 0; i < inputs.length; i++){ if (inputs[i].getAttribute('type') == 'checkbox'){ inputs[i].checked = state; } } } </script> </head> <body> <form method="post"> <table width="100%"> <tr><th style="width: 15px;"> </th><th style="width: 15px;"><input type="checkbox" id="chboxstate" name="" value="" onclick="checkall();" /></th><th>Virsraksts</th></tr> <tr class="dark_row"> <td class="on"> </td><td><input type="checkbox" name="news_selected[]" value="10152" id="frmNewsID10152" /></td><td><a href="?up=10152&datums=2005-09-16">^</a><a href="?down=10152&datums=2005-09-16">^</a> <label for="frmNewsID10152">Latvija zaudē izraēlai eiropas čepmionātā basketbolā</label></td> </tr> <tr class="light_row"> <td class="on"> </td><td><input type="checkbox" name="news_selected[]" value="10153" id="frmNewsID10153" /></td><td><a href="?up=10153&datums=2005-09-16">^</a><a href="?down=10153&datums=2005-09-16">v</a> <label for="frmNewsID10153">Policijas krīzes atrisināšanas plāns</label></td> </tr> <tr class="dark_row"> <td class="on"> </td><td><input type="checkbox" name="news_selected[]" value="10154" id="frmNewsID10154" /></td><td><a href="?up=10154&datums=2005-09-16">^</a><a href="?down=10154&datums=2005-09-16">v</a> <label for="frmNewsID10154">Krimināllietu atteikumi būs publiski</label></td> </tr> <tr class="light_row"> <td class="on"> </td><td><input type="checkbox" name="news_selected[]" value="10155" id="frmNewsID10155" /></td><td><a href="?up=10155&datums=2005-09-16">^</a><a href="?down=10155&datums=2005-09-16">v</a> <label for="frmNewsID10155">Ierosina legālo prezumpciju</label></td> </tr> <tr class="footer"><td colspan="3"><select name="action"><option value="disable">Noslēpt</option><option value="publish">Publicēt</option><option value="delete">Dzēst</option></select><input type="submit" value="Labi" /></td><td> </td></tr> </table></form> </body> </html> Link to comment Share on other sites More sharing options...
Recommended Posts