选择显示字体大小

这是我在做的一个系统中的新闻增加程序,可以上传图片,也可以输入绝对大于4k的内容(在textarea中),...


   <?php
/*******所用到的表结构********
drop table if exists index_news;
create table index_news (
   news_id bigint(20) not null auto_increment,
   news_date date default &#39;0000-00-00&#39; not null,
   news_title varchar(100) not null,
   news_content text,
   news_link varchar(100),
   is_new char(1) default &#39;1&#39;,
   picture_id int(11),
   picture_side char(1) default &#39;1&#39;,
   news_show char(1) default &#39;1&#39;,
   primary key (news_id),
   key id (news_id)
);
drop table if exists picture;
create table picture (
   id int(11) not null auto_increment,
   picture blob not null,
   picture_type varchar(50) not null,
   primary key (id),
   unique id (id)
);
**********************/
require(&quot;../include/date.inc.php3&quot;);
require(&quot;../include/config.inc.php3&quot;);
?>
<!doctype html public &quot;-//w3c//dtd html 4.0 transitional//en&quot;>

<html>
<head>
<title>修改首页新闻信息</title>
<script language=&quot;javascript&quot;>
<!--
function mm_findobj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexof(&quot;?&quot;))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=mm_findobj(n,d.layers[i].document); return x;
}

function mm_validateform() { //v3.0
  var i,p,q,nm,test,num,min,max,errors=&#39;&#39;,args=mm_validateform.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; obj_name=args[i+1]; val=mm_findobj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!=&quot;&quot;) {
      if (test.indexof(&#39;isemail&#39;)!=-1) { p=val.indexof(&#39;@&#39;);
        if (p<1 p==(val.length-1)) errors+=&#39;- &#39;+obj_name+&#39; 必须是一个e-mail地址.\n&#39;;
      } else if (test!=&#39;r&#39;) { num = parsefloat(val);
        if (val!=&#39;&#39;+num) errors+=&#39;- &#39;+obj_name+&#39; 必须是一个数字.\n&#39;;
        if (test.indexof(&#39;inrange&#39;) != -1) { p=test.indexof(&#39;:&#39;);
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min max<num) errors+=&#39;- &#39;+obj_name+&#39; 必须是一个在 &#39;+min+&#39; 和 &#39;+max+&#39;之间的数字.\n&#39;;
    } } } else if (test.charat(0) == &#39;r&#39;) errors += &#39;- &#39;+obj_name+&#39; 必须输入.\n&#39;; }
  } if (errors) alert(&#39;输入数据存在错误:\n&#39;+errors);
  document.mm_returnvalue = (errors == &#39;&#39;);
}
//-->
</script>
</head>

<body>
<?php
if (&#36;add){
    &#36;date=input2date(&#36;news_date);
    //echo &#36;picture . &quot;  &quot;. filesize(&#36;picture);
    //if (&#36;is_new!=&quot;0&quot;) &#36;is_new=&quot;1&quot; ;
    //if (&#36;news_show!=&quot;0&quot;) &#36;news_show=&quot;1&quot;;
    //if (&#36;picture_side!=&quot;2&quot;) &#36;picture_side=&quot;1&quot;;
    if (&#36;picture!=&quot;none&quot;){
        &#36;pic_data = addslashes(fread(&#36;fp=fopen(&#36;picture,&quot;r&quot;), filesize(&#36;picture)));
        &#36;i_str=&quot;insert into picture (picture,picture_type) values (&#39;&#36;pic_data&#39;,&#39;&#36;picture_type&#39;)&quot;;
        //&#36;rs->open(&#36;i_str);
        &#36;result=mysql_query(&#36;i_str,&#36;dbconnect);
        &#36;picture_id=mysql_insert_id();
        fclose(&#36;fp);
        unlink(&#36;picture);
    }
    else{
        &#36;picture_id=0 ;
    }
    &#36;i_str=&quot;insert into index_news (news_date,news_title,news_content,news_link,picture_id,is_new,picture_side,news_show) values &quot;;
    &#36;i_str.=&quot;(&#39;&#36;date&#39;,&#39;&#36;news_title&#39;,&#39;&#36;news_content&#39;,&#39;&#36;news_link&#39;,&#39;&#36;picture_id&#39;,&#39;&#36;is_new&#39;,&#39;&#36;picture_side&#39;,&#39;&#36;news_show&#39;) &quot;;

    if (mysql_query(&#36;i_str,&#36;dbconnect)) echo &quot;已添加!&quot;;

}

<form name=&quot;f&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot; action=&quot;<?php echo &#36;path_info; ?>&quot; >
  <table width=&quot;500&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;>
    <tr>
      <td colspan=&quot;2&quot;>
        <div align=&quot;center&quot;><font size=&quot;4&quot;>增加新闻信息</font></div>
      </td>
    </tr>
    <tr>
      <td colspan=&quot;2&quot;>  </td>
    </tr>
    <tr>
      <td width=&quot;100&quot;>新闻标题: </td>
      <td>
        <input type=&quot;text&quot; name=&quot;news_title&quot; size=&quot;60&quot;>
      </td>
    </tr>
    <tr>
      <td>新闻内容:</td>
      <td>
        <textarea name=&quot;news_content&quot; cols=&quot;58&quot; rows=&quot;5&quot;></textarea>
      </td>
    </tr>
    <tr>
      <td>新闻日期:</td>
      <td>
        <input type=&quot;text&quot; name=&quot;news_date&quot;>
        (日期请按照2000-01-02格式输入) </td>
    </tr>
    <tr>
      <td>新闻链接:</td>
      <td>
        <input type=&quot;text&quot; name=&quot;news_link&quot; size=&quot;60&quot;>
      </td>
    </tr>
    <tr>
      <td>是否最新:</td>
      <td>
        <select name=&quot;is_new&quot;>
          <option value=&quot;1&quot; selected>是最新</option>
          <option value=&quot;0&quot;>不是最新</option>
        </select>
      </td>
    </tr>
    <tr>
      <td>新闻图片:</td>
      <td>
        <input type=&quot;file&quot; name=&quot;picture&quot; size=&quot;50&quot;>
      </td>
    </tr>
    <tr>
      <td>图片位置:</td>
      <td>
        <select name=&quot;picture_side&quot;>
          <option value=&quot;1&quot; selected>左边</option>
          <option value=&quot;2&quot;>右边</option>
        </select>
      </td>
    </tr>
    <tr>
      <td>是否显示:</td>
      <td>
        <select name=&quot;news_show&quot;>
          <option value=&quot;1&quot; selected>显示</option>
          <option value=&quot;0&quot;>不显示</option>
        </select>
      </td>
    </tr>
    <tr>
      <td colspan=&quot;2&quot;>
        <div align=&quot;center&quot;>
          <input type=&quot;submit&quot; name=&quot;add&quot; value=&quot;增加&quot; onclick=&quot;mm_validateform(&#39;news_title&#39;,&#39;&#39;,&#39;r&#39;,&#39;news_date&#39;,&#39;&#39;,&#39;r&#39;,&#39;news_content&#39;,&#39;&#39;,&#39;r&#39;);return document.mm_returnvalue&quot;>
          <input type=&quot;button&quot; name=&quot;return&quot; value=&quot;返回&quot;>
          <input type=&quot;reset&quot; name=&quot;reset&quot; value=&quot;重新输入&quot;>
        </div>
      </td>
    </tr>
  </table>
  </form>
</body>
</html>


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons