Am facut...si acum nu mai submite nimic... cred ca formulez gresit onclickul din final... fara paranteze executa!
aici forma in functiune:
lrh.ro/test/pcp.php
<input type="submit" value="Trimite" name="submit" onClick="checkAll(this.form.elements['list2[]']); outputSelected(this.form.list2[].options); getSelected(this.form.list2[].options);">
Si iata si scripturile:
<SCRIPT LANGUAGE="JavaScript">
function getSelected(opt) {
var selected = new Array();
var index = 0;
for (var intLoop = 0; intLoop < opt.length; intLoop++) {
if ((opt[intLoop].selected) ||
(opt[intLoop].checked)) {
index = selected.length;
selected[index] = new Object;
selected[index].value = opt[intLoop].value;
selected[index].index = intLoop;
}
}
return selected;
}
function outputSelected(opt) {
var sel = getSelected(opt);
var strSel = "";
for (var item in sel)
strSel += sel[item].value + "\n";
alert("Selected Items:\n" + strSel);
}
</SCRIPT>
<script type="text/javascript">
function checkAll(el){
if ( el && /select/i.test(el.nodeName) ){
var o = el.options;
var i = o.length;
while ( i-- ) { o[i].selected = true; }
}
}
</script>


Răspunde cu citat