elabuwa Posted October 17, 2009 Share Posted October 17, 2009 Hi guys, i have this bit of php coding inside it I have 2 javascript functions being called. the php coding bit is as below. <?php If ($r > 1){ $k = 1; While ($k < $r){ /*$each_amount = $tramount[$k]; If ($tax_rate != "NA"){ $divider = $tax_rate * 100; $divider = 100 - $divider; $divided = $each_amount / $divider; $each_amount = $divided * 100; }*/ echo "<script language=javascript>addRow('dataTable')</script>"; //$acdescr[]; $w = 0; $ind = 0; $rab = 0; while ($w < $counter){ $acc = $idzz[$w]; If ($acc == $item_code[$k]){ $ind = $w; } $w++; } echo "<script language=javascript>setVals($k,$ind)</script>"; $w = 0; $k++; } } ?> The problem is the first JS function is being called and it works, but the second wont be called. I tried alerting at begining of the function atleast to check if it is being called. but no alerts come out. the second JS function is below. function setVals(tag_no,indexer) { alert (tag_no); var pointer = 3; var tagger= tag_no; var indd = indexer; indd = indd * 1; tagger = tagger * 1; var pointer1 = pointer + tagger; document.getElementsByTagName("select").item(pointer1).options[indd+1].selected = true; } Can you please point me in the right direction. PS: I wasnt sure if to post in php or JS but posted it here coz since php is workin and JS is not. Any help is highly appreciated. Link to comment https://forums.phpfreaks.com/topic/177995-solved-javascript-function-not-called-in-php/ Share on other sites More sharing options...
elabuwa Posted October 17, 2009 Author Share Posted October 17, 2009 any help? pwetty please Link to comment https://forums.phpfreaks.com/topic/177995-solved-javascript-function-not-called-in-php/#findComment-938557 Share on other sites More sharing options...
haku Posted October 17, 2009 Share Posted October 17, 2009 Show us the html output of that. PHP is irrelevant to javascript. Link to comment https://forums.phpfreaks.com/topic/177995-solved-javascript-function-not-called-in-php/#findComment-938625 Share on other sites More sharing options...
elabuwa Posted October 18, 2009 Author Share Posted October 18, 2009 hey haku, thanks for the reply. Apparently javascript stops workin when there is an error in it. never knew it. Firebug helped me identify it. Thanks anyway. Got it sorted. Link to comment https://forums.phpfreaks.com/topic/177995-solved-javascript-function-not-called-in-php/#findComment-938934 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.