2 functions compination...

Posted on 2006-05-25
Last Modified: 2012-06-27
I m tying to compine 2 functions....

function checkForm(theBtn, checkElem){
  var elem = theBtn.form.elements;
  for(var i=0;i<elem.length;i++){

a pair of radio buttons...
<input name="sel_shpm" type="radio" value="pre"  checked="checked" onclick="checkForm(this,{pre:1,'new':1})"  />
<input name="sel_shpm" type="radio" value="new"  onclick="checkForm(this,{pre:1,'new':1})"  />

and the textarea..
<textarea id="new_shpm_pol" name="new_shpm_pol"  cols="60" rows="10" disabled="disabled" class="new">

With this function i enable/disable the textarea

Now i want to add one more function to my radio buttons..

function setTextareaToTinyMCE(sEditorID) {
            var oEditor = document.getElementById(sEditorID);
            if(oEditor && !bTextareaWasTinyfied) {
                  tinyMCE.execCommand('mceAddControl', true, sEditorID);
                  bTextareaWasTinyfied = true;
      function unsetTextareaToTinyMCE(sEditorID) {
            var oEditor = document.getElementById(sEditorID);
            if(oEditor && bTextareaWasTinyfied) {
                  tinyMCE.execCommand('mceRemoveControl', true, sEditorID);
                  bTextareaWasTinyfied = false;

to the first radio button and
to the second radio button.

How can i do this???
Question by:NTGrE
    LVL 49

    Accepted Solution

    You can just do onclick="function1();function2();function3(); etc"

    <input name="sel_shpm" type="radio" value="pre"  checked="checked" onclick="checkForm(this,{pre:1,'new':1});unsetTextareaToTinyMCE('new_shpm_pol');" "  />

    <input name="sel_shpm" type="radio" value="new"  onclick="checkForm(this,{pre:1,'new':1});setTextareaToTinyMCE('new_shpm_pol');""  />

    LVL 12

    Assisted Solution

    Like this:

    <input name="sel_shpm" type="radio" value="pre"  checked="checked" onclick="checkForm(this,{pre:1,'new':1}); unsetTextareaToTinyMCE('new_shpm_pol')"  />
    <input name="sel_shpm" type="radio" value="new"  onclick="checkForm(this,{pre:1,'new':1}); setTextareaToTinyMCE('new_shpm_pol')"  />

    Author Comment

    Thnx friends....working fine.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now