//Have the propmt box turned on by default var promptOn = true; //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 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.frmAddMessage.message.value += "[" + code + "]" + insertCode + "[/" + code + "]"; } } else{ document.frmAddMessage.message.value += "[" + code + "][/" + code + "]"; } } document.frmAddMessage.message.focus(); } // Function to add the font colours, sizes, type to the message, to the message function FontCode(code) { if (code != "") { if (promptOn == true){ insertCode = prompt("Nhập text " + code + "\n[" + code + "]xxx[/FONT]", ''); if ((insertCode != null) && (insertCode != "")){ document.frmAddMessage.message.value += "[" + code + "]" + insertCode + "[/FONT]"; } } else{ document.frmAddMessage.message.value += "[" + code + "][/FONT]"; } } document.frmAddMessage.message.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")) { insertText = prompt("Nhập link", ""); if ((insertText != null) && (insertText != "") && (code == "URL")){ insertCode = prompt("Nhập URL", "http://"); if ((insertCode != null) && (insertCode != "") && (insertCode != "http://")){ document.frmAddMessage.message.value += "[" + code + "=" + insertCode + "]" + insertText + "[/" + code + "]"; } } } //For the email code if ((code != "") && (code == "EMAIL")) { insertText = prompt("Nhập email", ""); if ((insertText != null) && (insertText != "")){ insertCode = prompt("Nhập email", ""); if ((insertCode != null) && (insertCode != "")){ document.frmAddMessage.message.value += "[" + code + "=" + insertCode + "]" + insertText + "[/" + code + "]"; } } } //For the image code if ((code != "") && (code == "IMG")) { insertCode = prompt("Địa chỉ của hình", "http://"); if ((insertCode != null) && (insertCode != "")){ document.frmAddMessage.message.value += "[" + code + "]" + insertCode + "[/" + code + "]"; } } //For the list code if ((code != "") && (code == "LIST")) { if (promptOn == true){ listType = prompt("Loại danh sách \nEnter \'1\' dạng số hoặc để trống cho dạng bullet", ""); while ((listType != null) && (listType != "") && (listType != "1")) { listType = prompt("ERROR! \'1\' dạng số hoặc để trống cho dạng bullet",""); } if (listType != null) { var listItem = "1"; var insertCode = ""; while ((listItem != "") && (listItem != null)) { listItem = prompt("Danh sách, để trống để kết thúc danh sách.",""); if (listItem != "") { insertCode += "[LI]" + listItem + "[/LI]"; } } if (listType == "") { document.frmAddMessage.message.value += "[" + code + "]" + insertCode + "[/" + code + "]"; } else { document.frmAddMessage.message.value += "[" + code + "=" + listType + "]" + insertCode + "[/" + code + "=" + listType + "]"; } } } else{ document.frmAddMessage.message.value += "[" + code + "][LI] [/LI][LI] [/LI][LI] [/LI][/" + code + "]"; } } //For the indent if ((code != "") && (code == "INDENT")) { document.frmAddMessage.message.value += " "; } document.frmAddMessage.message.focus(); } //Function to add the code to the message for the smileys function AddSmileyIcon(iconCode) { document.frmAddMessage.message.value += iconCode + " "; }