⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addnews.asp

📁 非常好用的asp网页,有需要的同学可以下载学习,提供完整的代码.
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<!--#include file="conn.asp"-->
<!--#include file="session2.asp"-->
<%
 if request.QueryString("action")="save" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from sh_news",conn,1,3
rs.addnew
rs("newsname")=trim(request("newsname"))
rs("addname")=trim(request("addname"))

Content=Request.Form("Content")

'将里面的链接换成本地链接
 aa="http://"&Request.ServerVariables("server_name")&Request.ServerVariables("path_info")
 aa= mid(aa,1,len(aa)-17)		'16=admin/addnews.asp
 'response.write aa
 'response.end 
content=replace(content,aa,"")
session("content")=content
rs("newscontent")=content
rs("adddate")=now()
rs("viewcount")=0
rs.update
rs.close
set rs=nothing
session("content")=""
response.write "<script language=javascript>alert('添加成功!');window.location.href='editnews.asp';</script>"
response.End
end if
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
<!--
function checkdata()
{
if (document.form1.newsname.value=="")
	{
	  alert("对不起,请输入新闻主题!")
	  document.form1.newsname.focus()
	  return false
	 }
if (document.form1.viewhtml.checked == true)
	{
	  alert("对不起,请取消“查看HTML源代码”后再添加!")
	  document.form1.viewhtml.focus()
	  return false
	 }
if (document.form1.Content.value.length==0)
	{
	  alert("对不起,请输入文章内容!")
	  //document.form1.content.focus()
	  return false
	 }
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<script  language="JavaScript">
<!-- Hide from older browsers...

//Function to format text in the text box
function FormatText(command, option){
	
  	frames.message.document.execCommand(command, true, option);
  	frames.message.focus();
}

//Function to add image
function AddImage(){	
	imagePath = prompt('请输入图片地址', 'http://');				
	
	if ((imagePath != null) && (imagePath != "")){					
		frames.message.document.execCommand('InsertImage', false, imagePath);
  		frames.message.focus();
	}
	frames.message.focus();			
}

//Function to clear form
function ResetForm(){

	if (window.confirm('确认要清空对话框内容?')){
	 	frames.message.document.body.innerHTML = ''; 
	 	return true;
	 } 
	 return false;		
}

//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}

function setMode(newMode)
{
  bTextMode = newMode;
  var cont;
  if (bTextMode) {
    cleanHtml();
    cleanHtml();

    cont=message.document.body.innerHTML;
    message.document.body.innerText=cont;
  } else {
    cont=message.document.body.innerText;
    message.document.body.innerHTML=cont;
  }
  message.focus();
}

function cleanHtml()
{
  var fonts = message.document.body.all.tags("FONT");
  var curr;
  for (var i = fonts.length - 1; i >= 0; i--) {
    curr = fonts[i];
    if (curr.style.backgroundColor == "#ffffff") curr.outerHTML	= curr.innerHTML;
  }

}

// -->
</script>
<script language="JavaScript">

function help()
{
    var helpmess;
    helpmess="---------------填写帮助---------------\r\n\r\n"+
         "1.请不要发表有危险性的脚本。\r\n\r\n"+
         "2.如果要书写源代码,请选中\r\n\r\n"+
         " 查看HTML源代码书写.\r\n\r\n"+
         "3.需要你自己运行,才能看效果.\r\n\r\n"+
         "4.如果书写js,尽量不要在这儿书写.\r\n\r\n";
    alert(helpmess);
}
</script>
<script src="edit.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<form name="form1" method="post" action="addnews.asp?action=save" onSubmit="return checkdata()" onReset="return ResetForm();">
  <table cellpadding="3" cellspacing="1" border="0" width="100%" class="tableBorder" align=center>
    <tr> 
      <th class="tableHeaderText" colspan=6 height=25>添加新闻</th>
    </tr>
    <tr> 
      <td width="20%" class="forumRowHighlight" align=right>新闻主题:</td>
      <td width="80%" class="forumRowHighlight">&nbsp;&nbsp;<input name="newsname" type="text" id="newsname" size="30"> 
      </td>
    </tr>
    <tr> 
      <td  class="forumRowHighlight"align=right>发 表 人:</td>
      <td class="forumRowHighlight"> &nbsp;&nbsp;<input name="addname" type="text" id="addname" size="30"> 
      </td>
    </tr>
    <tr> 
      <td class="forumRowHighlight" align=right>新闻内容:</td>
      <td class="forumRowHighlight">&nbsp; <select name="selectFont" onChange="FormatText('fontname', selectFont.options[selectFont.selectedIndex].value);document.form1.selectFont.options[0].selected = true;"  style="font-family: 宋体; font-size: 9pt" onMouseOver="window.status='选择选定文字的字体。';return true;" onMouseOut="window.status='';return true;">
          <option selected>选择字体</option>
          <option value="宋体">宋体</option>
          <option value="楷体_GB2312">楷体</option>
          <option value="新宋体">新宋体</option>
          <option value="黑体">黑体</option>
          <option value="隶书">隶书</option>
          <option value="幼圆">幼圆</option>
          <option value="Andale Mono">Andale Mono</option>
          <option value=Arial>Arial</option>
          <option value="Arial Black">Arial Black</option>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -