//text area name var textArea = 'message'; //Have the propmt box turned on by default var promptOn = true; //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('
'); } //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('警告: 全部编辑内容都将丢失!')){ 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[/' + code + ']', InsertText); if ((insertCode != null) && (insertCode != '')){ document.getElementById(textArea).value += '[' + code + ']' + insertCode + '[/' + code + ']'; } } else{ document.getElementById(textArea).value += '[' + code + '][/' + 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[/' + endCode + ']', ''); if ((insertCode != null) && (insertCode != '')){ document.getElementById(textArea).value += '[' + code + ']' + insertCode + '[/' + endCode + ']'; } } else{ document.getElementById(textArea).value += '[' + code + '][/' + endCode + ']'; } } 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('键入链接中的屏幕显示内容', ''); if ((insertText != null) && (insertText != '') && (code == 'URL')){ insertCode = prompt('键入链接的URL位置', 'http://'); if ((insertCode != null) && (insertCode != '') && (insertCode != 'http://')){ document.getElementById(textArea).value += '[' + code + '=' + insertCode + ']' + insertText + '[/' + code + ']'; } } } else { document.getElementById(textArea).value += '[' + code + '= ][/' + code + ']'; } } //For the email code if ((code != '') && (code == 'EMAIL')){ if (promptOn == true){ insertText = prompt('键入E-mail地址中的屏幕显示内容', ''); if ((insertText != null) && (insertText != '')){ insertCode = prompt('键入E-mail地址', ''); if ((insertCode != null) && (insertCode != '')){ document.getElementById(textArea).value += '[' + code + '=' + insertCode + ']' + insertText + '[/' + code + ']'; } } } else { document.getElementById(textArea).value += '[' + code + '= ][/' + code + ']'; } } //For the image code if ((code != '') && (code == 'IMG')){ if (promptOn == true){ insertCode = prompt('键入图片的网络位置', 'http://'); if ((insertCode != null) && (insertCode != '')){ document.getElementById(textArea).value += '[' + code + ']' + insertCode + '[/' + code + ']'; } } else { document.getElementById("message").value += '[' + code + '][/' + code + ']'; } } //For the list code if ((code != '') && (code == 'LIST')){ if (promptOn == true){ listType = prompt('列表形式 \n键入 \'1\' 输入数字序号或留空', ''); while ((listType != null) && (listType != '') && (listType != '1')) { listType = prompt('错误!请输入 \'1\' 输入数字序号或留空',''); } if (listType != null){ var listItem = '1'; var insertCode = ''; while ((listItem != '') && (listItem != null)) { listItem = prompt('在新的列表符后直接回车以结束列表模式',''); if (listItem != '') { insertCode += '[li]' + listItem + '[/li]'; } } if (listType == '') { document.getElementById(textArea).value += '[' + code + ']' + insertCode + '[/' + code + ']'; } else { document.getElementById(textArea).value += '[' + code + '=' + listType + ']' + insertCode + '[/' + code + '=' + listType + ']'; } } } else{ document.getElementById(textArea).value += '[' + code + '][LI] [/LI][LI] [/LI][LI] [/LI][/' + code + ']'; } } //For the indent if ((code != '') && (code == 'INDENT')){ document.getElementById(textArea).value += ' '; } document.getElementById(textArea).focus(); } //Function to add the code to the message for the smileys function AddEmoticon(iconCode) { var txtarea = document.frmMessageForm.message; iconCode = ' ' + iconCode + ' '; if (txtarea.createTextRange && txtarea.caretPos) { var caretPos = txtarea.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? iconCode + ' ' : iconCode; txtarea.focus(); } else { txtarea.value += iconCode; txtarea.focus(); } } // 增加脚本用于非RTE方式时运用Ctrl+Enter快捷回复 //Insert at Claret position. function storeCaret(cursorPosition) { if (cursorPosition.createTextRange) cursorPosition.caretPos = document.selection.createRange().duplicate(); } //Ctrl+Enter submit Function: function keyDown(eventobject) { if(event.ctrlKey&&window.event.keyCode==13) this.document.frmMessageForm.submit(); } // END -- 增加脚本用于非RTE方式时运用Ctrl+Enter快捷回复 //增加的脚本用于处理源程序的一个BUG //Function to clear form function ClearForm(){ if (window.confirm("您确定要清空表单吗?")){ return true; } return false; }