Click to See Complete Forum and Search --> : call javascript
zebdaag
01-09-2004, 10:19 AM
Hi,
I got this script and I want it to call a other script it is working with checkboxes it watches wich boxes are false. So when check box c20 is false it has to call the script HideChose+p
But it doesn't work the way i tried below in what way will it work??
Greetz Zebb
function Hidea() {
for (var j = 13; j <= 24; j++) {
box = eval("document.FTab1Eraf.c"+j);
p = (j-12);
if (box.checked == false)
javascript: ("HideChosen"+p());
}
}
96turnerri
01-09-2004, 10:32 AM
Originally posted by zebdaag
Hi,
I got this script and I want it to call a other script it is working with checkboxes it watches wich boxes are false. So when check box c20 is false it has to call the script HideChose+p
But it doesn't work the way i tried below in what way will it work??
Greetz Zebb
function Hidea() {
for (var j = 13; j <= 24; j++) {
box = eval("document.FTab1Eraf.c"+j);
p = (j-12);
if (box.checked == false)
javascript: ("HideChosen"+p());
}
}
is hidechosen+p the function or is hidechosen and p both functions?
function Hidea() {
for (var j = 13; j <= 24; j++) {
box = eval("document.FTab1Eraf.c"+j);
p = (j-12);
if (box.checked == false)
HideChosen+p();
}
}
function Hidea() {
for (var j = 13; j <= 24; j++) {
box = eval("document.FTab1Eraf.c"+j);
p = (j-12);
if (box.checked == false)
HideChosen();
p();
}
}
jaegernaut
01-09-2004, 10:39 AM
I had started to answer this post as well, but then stopped on the +p issue.
From the script it looks like "p" is a variable carrying a numeric value. If that is the case then I believe Zeb is trying to call the function HideChosen1, or something similar depending on the value of "p".
I wasn't sure exactly how you would concatenate the two and call the function, so I've just been waiting for someone to answer that knows the best way to do that.
I'll be interested to see what the final answer is. :D
Pittimann
01-09-2004, 11:30 AM
Hi!
I am also not sure, but I think, zebdaag means something like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
var box;
function hidea(fieldname) {
box=eval("document.FTab1Eraf."+fieldname+".checked");
if (box==false){
p = parseInt(fieldname.replace('c','')-12);
hideChosen(p);
}
if (box==true){
p = parseInt(fieldname.replace('c','')-12);
showChosen(p);
}
}
function hideChosen(val){
box=eval("document.FTab1Eraf.c"+val+"");
box.disabled=true;
box.checked=false;
}
function showChosen(val){
box=eval("document.FTab1Eraf.c"+val+"");
box.disabled=false;
}
//-->
</script>
</head>
<body>
<form name="FTab1Eraf">
<input type="checkbox" name="c1" disabled> <input type="checkbox" name="c13" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c2" disabled> <input type="checkbox" name="c14" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c3" disabled> <input type="checkbox" name="c15" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c4" disabled> <input type="checkbox" name="c16" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c5" disabled> <input type="checkbox" name="c17" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c6" disabled> <input type="checkbox" name="c18" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c7" disabled> <input type="checkbox" name="c19" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c8" disabled> <input type="checkbox" name="c20" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c9" disabled> <input type="checkbox" name="c21" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c10" disabled> <input type="checkbox" name="c22" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c11" disabled> <input type="checkbox" name="c23" onClick="hidea(this.name)"><br>
<input type="checkbox" name="c12" disabled> <input type="checkbox" name="c24" onClick="hidea(this.name)"><br>
</form>
</body>
</html>
Cheers - Pit