Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling one js method from another js method ????

Status
Not open for further replies.

ibrahimkhans

Programmer
Jun 25, 2008
2
US
I have two js files js1 and js2..
In js1 , i have a method defined
function allowAlphaNumKey(..){ .. }

In js2, i have the following code:
function addProjectRow(tBody)
{
var Cell1 = '<TD nowrap width="20%">
<input type="text" name="txtName'+rowNumber+'" value="" onBlur = "allowAlphaNumKey(\"Project Number\",txtName)">
</TD>';
}

But it's showing script error...

Both the .js files are included in the jsp.. and in this jsp i have the following line..

<td nowrap='nowrap' width="10%" align='center'>
<a href="javascript:addProjectRow();" border="0" align="center">
Add Row
</a>
which calls addProjectRow() in js2 and from this js2's addProjectRow() method, iam trying to call allowAlphaNumKey(..) but getting script error..

Is it possible to call one js method from another js ???

 
Is the string value on multiple lines? Javascript doesn't like that.

It appears your code has several problems and potential problems.

Lee
 
Hi

Thanks guys..iam able to solve the issue.. i included both the .js files in .jsp.. and in the second js , i was able to call the method in first js.. same setting what i mentioned above.. but i just forgot to clear the browser cache after deploying the jsp and js files :)

Once i cleared the cache, everything is working fine.

Thanks for all your suggestions, great to know that i can get help in quicktime, will be very helpful ...

Byee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top