function isEmpty(string) { return !/\S+/.test(string); }
function validate(form) { var controls = form.elements;
/* Requiring only one of either state or zip code seemed * rather odd (though I'm not an American, admittedly), so * the code below doesn't follow the original logic. */ if (controls.first.value == controls.second.value) alert('You can select the same in first and second choice'); return false; </script>
echo"<form name=\"form1\" method=\"post\" action=\"?action=joined&sid=$sid\" onsubmit=\"return validate(this);\"> <br><br><center><p>To join select 2 division for <br><br>Team $description from $clantag $clanname <br><br>1 st. choice <select id=\"first\">";
$get = mysql_query("select * from division WHERE season='$seasonnr' AND activdivision='1'"); echo ""; while($row = mysql_fetch_array($get)) {
echo"<br><br><input name=\"submit\" type=\"submit\" value=\"Signup season $seasonnr \"></form></center></p><br><br> <p>Join rules.<br><br>The joining team must have at least 5 members that has approved punkbuster guid.<br><br> The staff will check this before the team will be set into there division and activated. </p>";
function isEmpty(string) { return !/\S+/.test(string); }
function validate(form) { var controls = form.elements;
/* Requiring only one of either state or zip code seemed * rather odd (though I'm not an American, admittedly), so * the code below doesn't follow the original logic. */ if (controls.first.value == controls.second.value) alert('You can select the same in first and second choice'); return false; </script>
function isEmpty(string) { return !/\S+/.test(string); }
function validate(form) { /* Requiring only one of either state or zip code seemed * rather odd (though I'm not an American, admittedly), so * the code below doesn't follow the original logic. */ if (document.getElementById(\"first\").value == document.getElementById(\"second\").value){ alert('You can\'t select the same in first and second choice'); return false; } </script>
Nåå, det drejer sig om selects. Så skal du bruge dette i stedet:
<script language=\"javascript\" type=\"text/javascript\"> function isEmpty(string) { return !/\S+/.test(string); }
function validate(form) { /* Requiring only one of either state or zip code seemed * rather odd (though I'm not an American, admittedly), so * the code below doesn't follow the original logic. */ var oFirst=document.getElementById(\"first\"); var oSecond=document.getElementById(\"second\"); if (oFirst.options[oFirst.selectedIndex].value == oSecond.options[oSecond.selectedIndex].value){ alert('You can\'t select the same in first and second choice'); return false; } } </script>
I øvrigt manglede der en afsluttende "}", som nu er tilføjet. Den vil have resulteret i en JavaScript-fejl, som kan ses som en advarselstrekant i nederste venstre hjørne af skærmen.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.