Link to home
Start Free TrialLog in
Avatar of NTGrE
NTGrE

asked on

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???
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NTGrE
NTGrE

ASKER

Thnx friends....working fine.
:))