Heey allesammen
Jeg ville lave et script der tæller hvor mange checkboxe du har
checked, og det virker men hvis jeg laver en if(f=1) så springer
den bare let og elefant hen over den...
SCRIPT:
<script type="text/javascript">
function confirm_entry(f)
{
var t=0;
var antal=0;
var c=f['slet[]'];
for(var i=0;i<c.length;i++){
c[i].checked?t++:null;
}
if(f<1){
alert("Du skal vælge minimum 1 besked du vil slette");
}else{
if(f<2){
antal = "denne besked";
}else{
antal = "disse beskeder";
}
input_box=confirm('Er du sikker på du vil slette ' + antal +
'?');
if (input_box==true){
document.beskeder.submit();
} else {
}}}
</script>
<form name="beskeder" id="beskeder"
action="indbakke?tool=delete_more" method="post">
<input type="button" value="Inbox" style="width:75px;" id="input"
onClick="window.location='post'" /> <input type="button"
value="Send Besked" id="input" style="width:75px;"
onClick="window.location='indbakke?state=send'" /> <input
type="button" onClick="confirm_entry(this.form)" value="Slet"
id="input" style="width:75px;"><br /><br />
<table width="752" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="background:#999999;" width="52"
align="center">Slet</td>
<td style="background:#999999;" width="500">Emne</td>
<td style="background:#999999;" width="100"
align="center">Afsender</td>
<td style="background:#999999;" width="100"
align="center">Modtaget</td>
</tr>
<tr>
<td style="background:#CCCCCC;" align="center"><input
type="checkbox" name="slet[]" value="21" /></td>
<td onClick="window.location='indbakke?state=read&id=21'"
style="cursor:pointer; background:#CCCCCC;">lol</td>
<td style="background:#CCCCCC;" align="center">Mrblondie</td>
<td style="background:#CCCCCC;" align="center">11/11 - 2009</td>
</tr>
<tr>
<td style="background:#CCCCCC;" align="center"><input
type="checkbox" name="slet[]" value="20" /></td>
<td onClick="window.location='indbakke?state=read&id=20'"
style="cursor:pointer; background:#CCCCCC;">lol</td>
<td style="background:#CCCCCC;" align="center">Mrblondie</td>
<td style="background:#CCCCCC;" align="center">11/11 - 2009</td>
</tr>
<tr>
<td style="background:#CCCCCC;" align="center"><input
type="checkbox" name="slet[]" value="19" /></td>
<td onClick="window.location='indbakke?state=read&id=19'"
style="cursor:pointer; background:#CCCCCC;">lol</td>
<td style="background:#CCCCCC;" align="center">Mrblondie</td>
<td style="background:#CCCCCC;" align="center">11/11 - 2009</td>
</tr>
<tr>
<td style="background:#CCCCCC;" align="center"><input
type="checkbox" name="slet[]" value="18" /></td>
<td onClick="window.location='indbakke?state=read&id=18'"
style="cursor:pointer; background:#CCCCCC;">lol</td>
<td style="background:#CCCCCC;" align="center">Mrblondie</td>
<td style="background:#CCCCCC;" align="center">11/11 - 2009</td>
</tr>
<tr>
<td style="background:#CCCCCC;" align="center"><input
type="checkbox" name="slet[]" value="17" /></td>
<td onClick="window.location='indbakke?state=read&id=17'"
style="cursor:pointer; background:#CCCCCC;">lol</td>
<td style="background:#CCCCCC;" align="center">Mrblondie</td>
<td style="background:#CCCCCC;" align="center">11/11 - 2009</td>
</tr>
<tr>
<td style="background:#CCCCCC;" align="center"><input
type="checkbox" name="slet[]" value="16" /></td>
<td onClick="window.location='indbakke?state=read&id=16'"
style="cursor:pointer; background:#CCCCCC;">lol</td>
<td style="background:#CCCCCC;" align="center">Mrblondie</td>
<td style="background:#CCCCCC;" align="center">11/11 - 2009</td>
</tr>
</table>
</form>
det der er javascriptet
hvad er der i vejen med den?
--
Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials