• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

2 functions compination...

Hello.....
I m tying to compine 2 functions....

1st)
function checkForm(theBtn, checkElem){
  var elem = theBtn.form.elements;
  for(var i=0;i<elem.length;i++){
    if(checkElem[elem[i].className]){
      elem[i].disabled=(elem[i].className!=theBtn.value);
    }
  }
}

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;
            }
            return;
      }
      function unsetTextareaToTinyMCE(sEditorID) {
            var oEditor = document.getElementById(sEditorID);
            if(oEditor && bTextareaWasTinyfied) {
                  tinyMCE.execCommand('mceRemoveControl', true, sEditorID);
                  bTextareaWasTinyfied = false;
            }
            return;
      }

onClick="unsetTextareaToTinyMCE('new_shpm_pol');"
to the first radio button and
onClick="setTextareaToTinyMCE('new_shpm_pol');"
to the second radio button.

How can i do this???
0
NTGrE
Asked:
NTGrE
2 Solutions
 
RoonaanCommented:
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');""  />

-r-
0
 
_Maddog_Commented:
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')"  />
0
 
NTGrEAuthor Commented:
Thnx friends....working fine.
:))
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now