Jump to content

[SOLVED] Javascript function not called in php


elabuwa

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.