Well friends, I have just found this forum thro' google, so this is my first post.
I need to move the following code as a javascript function -
As you can see, I need mixed / combined variables here, like inter_<?=$cid?> (I have used php here, since the javascript is a part of the main page, till now).
However, I want to move that to an external file, and tried doing something like -
It's not working. Wondering how can I get an equivalent of inter_<?=$cid?> in this function, where the value of $cid will come as a function argument.
Any help will be appreciated. Thanks.
Merry christmass to all
I need to move the following code as a javascript function -
Code:
<script type="text/javascript">
<!--
var inter_<?=$cid?> = document.getElementById('chocQnty_<?=$cid?>');
if (inter_<?=$cid?> && inter_<?=$cid?>.value) {
var cqnty_<?=$cid?> = inter_<?=$cid?>.value;
} else {
var cqnty_<?=$cid?> = 0;
}
chocArray[<?=$countNo?>] = cqnty_<?=$cid?> + "~" + <?=$cprix?>;
ajaxArr[<?=$countNo?>] = <?=$cid?> + "~" + cqnty_<?=$cid?>;
subChoc('chocQnty_<?=$cid?>','totale_<?=$cid?>',<?=$cprix?>,chocArray,<?=$countNo?>,"",<?=$cid?>,ajaxArr);
//-->
</script>
However, I want to move that to an external file, and tried doing something like -
Code:
function onloadEvents(cid,countNo,cprix) {
var inter_+cid = document.getElementById('chocQnty_'+cid);
}
It's not working. Wondering how can I get an equivalent of inter_<?=$cid?> in this function, where the value of $cid will come as a function argument.
Any help will be appreciated. Thanks.
Merry christmass to all