codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  onclick multiple functions  lewnussi at 20:59 on Sunday, March 02, 2008
 

I am trying to call more than one function starting with onclick in a form.

In the form, this does not work:
[code]
<input type="submit" value="thevalue" name="goodname" onclick="return function_1(this.form);function_2(this.form);" />
[/code]

So I tried only function_1 for the onclick, and put this in a .js file, but it also does not work:
[code]
function function_1(health)
{
if(health.phone.value=="")
{
alert("Please enter your home telephone number.\n");
return false;
function_2();
}
return true;
}

function function_2(health)
{

if(health.first_name.value.length<2)
{
alert("Please enter your first name.\n");
return false;
}
return true;
}
[/code]
In both cases, the first function works, but not the second, and the Firefox Error Console does not return an error.

How do I call function_2?

  Re: onclick multiple functions  MattoThePotatto at 08:58 on Wednesday, June 25, 2008
 

onClick="function1();function1()"

Just seperate them with a ; .

  onclick multiple functions  godlymathew77 at 08:31 on Sunday, August 10, 2008
 

a simple method.

function callFunc()
{
function_1();
function_2();
}

this.onclik=callFunc;








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
• Re: store string from text file to vector
• Re: c# .net Exception of type System.StackOverflowException was thrown.
• Re: error: expression must have a constant value
• Re: Script Does Folder Exist – If Not Create It
• $_GET not working
• GET METHOD
• Re: windows service - web service - com
• Re: Storing data from HTML to Excel or TXT
• Re: Help totalReads=1 totalReads++=2 write totalReads 3 not 2


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010