File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes call function from other function in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "call function from other function in javascript" Watch "call function from other function in javascript" New topic
Author

call function from other function in javascript

johny mill
Greenhorn

Joined: Jul 08, 2006
Posts: 13
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

Joined: Jun 30, 2006
Posts: 62
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<br /><a href="http://keelypavan.blogspot.com" target="_blank" rel="nofollow">http://keelypavan.blogspot.com</a>
Pavan Keely
Ranch Hand

Joined: Jun 30, 2006
Posts: 62
Forgot to mention what was the change in my code. I used escaped double quotes for the onclick attribute value.
 
 
subject: call function from other function in javascript