Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

call function from other function in javascript

 
johny mill
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My javascript is

script language="javascript"
function pharmacy_billing_bill()
{
var tab = document.getElementById ("billing");
var index = document.getElementById ("rowIndex").rowIndex;
var newRow = tab.insertRow ( index);
if(index%2)
newRow.style.backgroundColor="#CCCCCC";
else
newRow.style.backgroundColor="#FFFFFF";

var newCell = newRow.insertCell();
txtname= index;
newCell.style.textAlign="center";
var htmltext = "input type='text' name='" + txtname + "' size='6'";
newCell.innerHTML = htmltext;

newCell = newRow.insertCell();
newCell.style.textAlign="center";
txtname= index;
htmltext = "input type='text' name='"+txtname+"' size='10' ";
newCell.innerHTML = htmltext;

var newCell = newRow.insertCell();
txtname= index;
newCell.style.textAlign="center";
var htmltext = "<nput type='text' name='" + txtname + "' size='11'   a href='javascript:selectDate('one')'>CALC";
newCell.innerHTML = htmltext;
}
var success = "";
var dd="";
function selectDate(dateValue,flag)
{
displaydate(dateValue,flag)
}
function displaydate(d,f)
{
success = f;
dd=d;
if(f == "one")
{
newWindow = window.open('calendar.html','optionsPopup','channelmode = no,toolbar = no,scrollbar = no,status = no,directories = no,menubar = no,personalbar = no,resizable = no,width = 180,height=430,left=370,top=155');
newWindow.focus();
}
}
function assignDate(p)
{
if(success == "one")
{
dd.value= p;
success = "";
}
window.focus();
}
/script


i have an hypher link in html called CALC when i click this selectDate method called directly ,

it works fine,

But when i click ADDMORE button one more row added in my html using the javascript method pharmacy_billing_bill()

when i click CALC (in pharmacy_billing_bill()) selectDate() is not called

help me,

Thanks in advance
 
Pavan Keely
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Problem seems to be with how you defining the html content in JavaScript.



Try changing that. I haven't gone through your code completely but if it doesn;t solve the problem, I'll look further.
 
Pavan Keely
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forgot to mention what was the change in my code. I used escaped double quotes for the onclick attribute value.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic