我见过的用ASP写的最好的留言簿程序

源代码在线查看: topic.js

软件大小: 141 K
上传用户: zhousiqi420
关键词: ASP 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				var Bold  = 0;
				var Italic = 0;
				var Underline = 0;
				function fontchuli(){
				if ((document.selection)&&(document.selection.type == "Text")) {
				var range = document.selection.createRange();
				var ch_text=range.text;
				range.text = fontbegin + ch_text + fontend;
				} 
				else {
				document.topic.content.value=fontbegin+document.topic.content.value+fontend;
				document.topic.content.focus();
				}
				}
				function AddText(text) {
					if (document.topic.content.createTextRange && document.topic.content.caretPos) {      
						var caretPos = document.topic.content.caretPos;      
						caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
						text + ' ' : text;
					}
					else document.topic.content.value += text;
					document.topic.content.focus(caretPos);
				}
				function COLOR(color){
				fontbegin="[color="+color+"]";
				fontend="[/color]";
				fontchuli();
				}
				helpstat = false;
				stprompt = true;
				basic = false;
				function thelp(swtch){
					if (swtch == 1){
						basic = false;
						stprompt = false;
						helpstat = true;
					} else if (swtch == 0) {
						helpstat = false;
						stprompt = false;
						basic = true;
					} else if (swtch == 2) {
						helpstat = false;
						basic = false;
						stprompt = true;
					}
				}
				function Crm() {
					if (helpstat) {
				               alert("realplay\n播放realplay文件.\n用法: [rm=宽度, 高度]文件地址[/rm]");
					} else if (basic) {
						AddTxt="[rm=500,350][/rm]";
						AddText(AddTxt);
					} else { 
						txt2=prompt("视频的宽度,高度","500,350"); 
						if (txt2!=null) {
							txt=prompt("视频文件的地址","请输入");
							if (txt!=null) {
								if (txt2=="") {
									AddTxt="[rm=500,350]"+txt;
									AddText(AddTxt);
									AddTxt="[/rm]";
									AddText(AddTxt);
								} else {
									AddTxt="[rm="+txt2+"]"+txt;
									AddText(AddTxt);
									AddTxt="[/rm]";
									AddText(AddTxt);
								}         
							} 
						}
					}
				}
				
				function Cwmv() {
					if (helpstat) {
				               alert("Media Player\n播放Media Player文件.\n用法: [mp=宽度, 高度]文件地址[/mp]");
					} else if (basic) {
						AddTxt="[mp=500,350][/mp]";
						AddText(AddTxt);
					} else { 
						txt2=prompt("视频的宽度,高度","500,350"); 
						if (txt2!=null) {
							txt=prompt("视频文件的地址","请输入");
							if (txt!=null) {
								if (txt2=="") {
									AddTxt="[mp=500,350]"+txt;
									AddText(AddTxt);
									AddTxt="[/mp]";
									AddText(AddTxt);
								} else {
									AddTxt="[mp="+txt2+"]"+txt;
									AddText(AddTxt);
									AddTxt="[/mp]";
									AddText(AddTxt);
								}         
							} 
						}
					}
				}
				function Cdir() {
					if (helpstat) {
				               alert("Shockwave\n插入Shockwave文件.\n用法: [dir=宽度, 高度]文件地址[/dir]");
					} else if (basic) {
						AddTxt="[dir=500,350][/dir]";
						AddText(AddTxt);
					} else { 
						txt2=prompt("Shockwave文件的宽度,高度","500,350"); 
						if (txt2!=null) {
							txt=prompt("Shockwave文件的地址","请输入地址");
							if (txt!=null) {
								if (txt2=="") {
									AddTxt="[dir=500,350]"+txt;
									AddText(AddTxt);
									AddTxt="[/dir]";
									AddText(AddTxt);
								} else {
									AddTxt="[dir="+txt2+"]"+txt;
									AddText(AddTxt);
									AddTxt="[/dir]";
									AddText(AddTxt);
								}         
							} 
						}
					}
				}
				function image() {
				var FoundErrors = '';
				var enterURL   = prompt("请输入图片地址","http://");
				if (!enterURL) {
				FoundErrors +="\n" + "您必须输入图片的有效地址";
				}
				if (FoundErrors) {
				alert("错误!"+FoundErrors);
				return;
				}
				var ToAdd = "[img]"+enterURL+"[/img]";
				document.topic.content.value+=ToAdd;
				document.topic.content.focus();
				}
				function fly() {
				fontbegin="[fly]";
				fontend="[/fly]";
				fontchuli();
				}
				function move() {
				fontbegin="[move]";
				fontend="[/move]";
				fontchuli();
				}
				function center() {
				fontbegin="[center]";
				fontend="[/center]";
				fontchuli();
				}
				function light() {
				fontbegin="[light]";
				fontend="[/light]";
				fontchuli();
				}
				function ying() {
				fontbegin="[shadow=255,red,1]";
				fontend="[/shadow]";
				fontchuli();
				}
				function Curl() {
				var FoundErrors = '';
				var enterURL   = prompt("请输入连接网址", "http://");
				var enterTxT   = prompt("请输入连接说明", enterURL);
				if (!enterURL)    {
				FoundErrors += "\n" + "您必须输入网址";
				}
				if (!enterTxT)    {
				FoundErrors += "\n" + "您必须连接说明";
				}
				if (FoundErrors)  {
				alert("错误!"+FoundErrors);
				return;
				}
				var ToAdd = "[url="+enterURL+"]"+enterTxT+"[/url]";
				document.topic.content.value+=ToAdd;
				document.topic.content.focus();
				}
				function Cemail() {
				var emailAddress = prompt("请输入邮件地址","");
				if (!emailAddress) { alert("请输入正确的email地址"); return; }
				var ToAdd = "[email]"+emailAddress+"[/email]";
				document.topic.content.value+=ToAdd;
				document.topic.content.focus();
				}
				function Cbold() {
				fontbegin="[b]";
				fontend="[/b]";
				fontchuli();
				}
				function Citalic() {
				fontbegin="[i]";
				fontend="[/i]";
				fontchuli();
				}
				function Cunder() {
				fontbegin="[u]";
				fontend="[/u]";
				fontchuli();
				}
				function Csound() {
				var FoundErrors = '';
				var enterURL   = prompt("请输入背景音乐地址", "http://");
				if (!enterURL) {
				FoundErrors += "\n" + "您必须要输入背景音乐的有效地址";
				}
				if (FoundErrors) {
				alert("错误!"+FoundErrors);
				return;
				}
				var ToAdd = "[sound]"+enterURL+"[/sound]";
				document.topic.content.value+=ToAdd;
				document.topic.content.focus();
				}
				
				
				function insertsmilie(smilieface)
				{
				document.topic.content.value+=smilieface;
				}
				
				function check(){
					if((document.topic.content.value.length>300) || (document.topic.content.value.length					alert("留言内容必须在 "+5+" - "+300+" 个字数之间!");
					document.topic.content.focus();
					return false;
				}}
				
				function count(message,total,used,remain)
				{
					var max;
					max = total.value;
					if (message.value.length > max) {
					message.value = message.value.substring(0,max);
					used.value = max;
					remain.value = 0;
					alert("您发表的内容已经超过限制的字数"+max+"!\n系统将自动裁减超出的部分内容!");
					}
					else {
					used.value = message.value.length;
					remain.value = max - used.value;
					}
				}			

相关资源