//text area name var textArea = 'myTextarea'; //Have the propmt box turned on by default var promptOn = true; //initialise area function initialiseWebWizRTE(){ //make toolbar the same size document.getElementById('toolbar').width = parseInt(document.getElementById(textArea).offsetWidth) + 2 + 'px'; } //Create toolbar function WebWizRTEtoolbar(formName){ document.writeln(''); document.writeln(' '); document.writeln(' '); document.writeln('
'); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln('
'); document.writeln(' '); document.writeln(''); document.writeln(''); document.writeln('        '); document.writeln('
'); } //Function to turn on or off the prompt box function PromptMode(selectMode){ if (selectMode.options[selectMode.selectedIndex].value == 0){ promptOn = false; } else{ promptOn = true; } } //function to clear area function clearWebWizRTE(){ if (window.confirm('WARNING: All editor data will be lost!!')){ document.getElementById(textArea).value=''; } } // Function to add the code for bold italic centre and underline, to the message function AddMessageCode(code, promptText, InsertText){ if (code != ''){ if (promptOn == true){ insertCode = prompt(promptText + '\n<' + code + '>xxx', InsertText); if ((insertCode != null) && (insertCode != '')){ document.getElementById(textArea).value += '<' + code + '>' + insertCode + ''; } } else{ document.getElementById(textArea).value += '<' + code + '>'; } } document.getElementById(textArea).focus(); } // Function to add the font colours, sizes, type to the message function FontCode(code, endCode) { if (code != ''){ if (promptOn == true){ insertCode = prompt(' ' + code + '\n<' + code + '>xxx', ''); if ((insertCode != null) && (insertCode != '')){ document.getElementById(textArea).value += '<' + code + '>' + insertCode + ''; } } else{ document.getElementById(textArea).value += '<' + code + '>'; } } document.getElementById(textArea).focus(); } //Function to add the URL, indent, list, and Email code to the message function AddCode(code){ //For the URL code if ((code != '') && (code == 'URL')){ if (promptOn == true){ insertText = prompt('Enter the on screen display text for the Hyperlink', ''); if ((insertText != null) && (insertText != '') && (code == 'URL')){ insertCode = prompt('Enter the URL address to create Hyperlink to', 'http://'); if ((insertCode != null) && (insertCode != '') && (insertCode != 'http://')){ document.getElementById(textArea).value += '' + insertText + ''; } } } else { document.getElementById(textArea).value += ''; } } //For the email code if ((code != '') && (code == 'EMAIL')){ if (promptOn == true){ insertText = prompt('Enter the on screen display text for the email address', ''); if ((insertText != null) && (insertText != '')){ insertCode = prompt('Enter the email address to link to', ''); if ((insertCode != null) && (insertCode != '')){ document.getElementById(textArea).value += '' + insertText + ''; } } } else { document.getElementById(textArea).value += ''; } } //For the image code if ((code != '') && (code == 'IMG')){ if (promptOn == true){ insertCode = prompt('Enter the web address of the image', 'http://'); if ((insertCode != null) && (insertCode != '')){ document.getElementById(textArea).value += ''; } } else { document.getElementById("message").value += ''; } } //For the list code if ((code != '') && (code == 'LIST')){ if (promptOn == true){ listType = prompt('Type of list \nEnter \'1\' for numbered or leave blank for bulleted', ''); while ((listType != null) && (listType != '') && (listType != '1')) { listType = prompt('ERROR! Please enter \'1\' for numbered or leave blank for bulleted',''); } if (listType != null){ var listItem = '1'; var insertCode = ''; while ((listItem != '') && (listItem != null)) { listItem = prompt('List item Leave blank to end list',''); if (listItem != '') { insertCode += '
  • ' + listItem + '
  • '; } } if (listType == '') { document.getElementById(textArea).value += ''; } else { document.getElementById(textArea).value += '
      ' + insertCode + '
    '; } } } else{ document.getElementById(textArea).value += ''; } } //For the indent if ((code != '') && (code == 'INDENT')){ document.getElementById(textArea).value += ' '; } document.getElementById(textArea).focus(); }