1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

再次请教问题

本帖由 lane2006-03-24 发布。版面名称:前端开发

  1. lane

    lane New Member

    注册:
    2005-09-05
    帖子:
    6,548
    赞:
    29
    问题一:

    为什么我把header.htm换了之后下面表格里的内容就全部居中了呢?换回原来的就不会居中了。

    我要换上的header源文件代码
    代码:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <!-- saved from url=(0014)about:internet -->
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>{$this->set[sysTitle]} - $modName</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    
    <link rel="stylesheet" href="{$this->tplPath}/css/default.css" type="text/css">
    
    <script language="JavaScript">
    <!--
    function mmLoadMenus() {
      if (window.mm_menu_0916132959_0) return;
        window.mm_menu_0916132959_0 = new Menu("root",96,20,"宋体",14,"#000000","#333333","#FF8F00","#3AADE3","center","middle",3,0,0,-5,7,true,true,true,0,true,true);
      mm_menu_0916132959_0.addMenuItem("院长致辞","location='0/5/0.html'");
      mm_menu_0916132959_0.addMenuItem("本院简介","location='0/5/1.html'");
      mm_menu_0916132959_0.addMenuItem("现任领导","location='0/5/2.html'");
      mm_menu_0916132959_0.addMenuItem("历史沿革","location='0/5/3.html'");
      mm_menu_0916132959_0.addMenuItem("组织机构","location='0/5/4.html'");
       mm_menu_0916132959_0.hideOnMouseOut=true;
       mm_menu_0916132959_0.bgColor='#555555';
       mm_menu_0916132959_0.menuBorder=2;
       mm_menu_0916132959_0.menuLiteBgColor='';
       mm_menu_0916132959_0.menuBorderBgColor='';
        window.mm_menu_0916140508_0 = new Menu("root",96,20,"宋体",14,"#000000","#333333","#FF8F00","#3AADE3","center","middle",3,0,0,-5,7,true,true,true,0,true,true);
      mm_menu_0916140508_0.addMenuItem("本科生教育","location='2/7/0.html'");
      mm_menu_0916140508_0.addMenuItem("研究生教育","location='2/7/1.html'");
      mm_menu_0916140508_0.addMenuItem("第二学位","location='2/7/2.html'");
      mm_menu_0916140508_0.addMenuItem("一实两创","location='2/7/3.html'");
       mm_menu_0916140508_0.hideOnMouseOut=true;
       mm_menu_0916140508_0.bgColor='#555555';
       mm_menu_0916140508_0.menuBorder=2;
       mm_menu_0916140508_0.menuLiteBgColor='';
       mm_menu_0916140508_0.menuBorderBgColor='';
        window.mm_menu_0921211431_0 = new Menu("root",96,20,"宋体",14,"#000000","#333333","#FF8F00","#3AADE3","center","middle",3,0,0,-5,7,true,true,true,0,true,true);
      mm_menu_0921211431_0.addMenuItem("校庆专栏","location='8/13/0.html'");
      mm_menu_0921211431_0.addMenuItem("校友名录","location='8/13/1.html'");
      mm_menu_0921211431_0.addMenuItem("校友留言","location='8/13/2.html'");
       mm_menu_0921211431_0.hideOnMouseOut=true;
       mm_menu_0921211431_0.menuBorder=2;
       mm_menu_0921211431_0.menuLiteBgColor='';
       mm_menu_0921211431_0.menuBorderBgColor='';
    
    mm_menu_0921211431_0.writeMenus();
    } // mmLoadMenus()
    //-->
    </script>
    <script language="JavaScript" src="{$this->tplPath}/images/mm_menu.js"></script>
    
    <!--Fireworks 8 Dreamweaver 8 target.  Created Wed Mar 22 22:15:26 GMT+0800 2006-->
    </head>
    <body bgcolor="#ffffff">
    <script language="JavaScript1.2">mmLoadMenus();</script>
    <table border="0" cellpadding="0" cellspacing="0" width="837" align="center">
    <!-- fwtable fwsrc="index1.png" fwbase="header.jpg" fwstyle="Dreamweaver" fwdocid = "1127642314" fwnested="0" -->
      <tr>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="7" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="198" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="23" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="6" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="78" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="4" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="13" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="83" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="4" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="96" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="4" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="96" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="3" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="19" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="77" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="4" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="120" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
      </tr>
    
      <tr>
       <td rowspan="2" colspan="2"><img name="header_r1_c1" src="{$this->tplPath}/images/header_r1_c1.jpg" width="205" height="62" border="0" id="header_r1_c1" alt="" /></td>
       <td rowspan="2" colspan="13"><img name="header_r1_c3" src="{$this->tplPath}/images/header_r1_c3.jpg" width="430" height="62" border="0" id="header_r1_c3" alt="" /></td>
       <td rowspan="2" colspan="3"><img name="header_r1_c16" src="{$this->tplPath}/images/header_r1_c16.jpg" width="201" height="62" border="0" id="header_r1_c16" alt="" /></td>
       <td><img name="header_r1_c19" src="{$this->tplPath}/images/header_r1_c19.jpg" width="1" height="60" border="0" id="header_r1_c19" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="60" border="0" alt="" /></td>
      </tr>
      <tr>
       <td rowspan="3"><img name="header_r2_c19" src="{$this->tplPath}/images/header_r2_c19.jpg" width="1" height="41" border="0" id="header_r2_c19" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="2" border="0" alt="" /></td>
      </tr>
      <tr>
       <td rowspan="2" colspan="2"><img name="header_r3_c1" src="{$this->tplPath}/images/header_r3_c1.jpg" width="205" height="39" border="0" id="header_r3_c1" alt="" /></td>
       <td colspan="3"><a href="index.html"><img src="{$this->tplPath}/images/header_r3_c3.jpg" border="0" width="107" height="33" /></a></td>
       <td><img name="header_r3_c6" src="{$this->tplPath}/images/header_r3_c6.jpg" width="4" height="33" border="0" id="header_r3_c6" alt="" /></td>
       <td colspan="2"><a href="0/5/index.html" onMouseOver="MM_showMenu(window.mm_menu_0916132959_0,0,28,null,'image1')" onMouseOut="MM_startTimeout();"><img src="{$this->tplPath}/images/header_r3_c7.jpg" border="0" width="96" height="33" id="image1" /></a></td>
       <td><img name="header_r3_c9" src="{$this->tplPath}/images/header_r3_c9.jpg" width="4" height="33" border="0" id="header_r3_c9" alt="" /></td>
       <td><img src="{$this->tplPath}/images/header_r3_c10.jpg" border="0" width="96" height="33" id="image2" /></td>
       <td><img name="header_r3_c11" src="{$this->tplPath}/images/header_r3_c11.jpg" width="4" height="33" border="0" id="header_r3_c11" alt="" /></td>
       <td><a href="0/5/index.html" onMouseOver="MM_showMenu(window.mm_menu_0916140508_0,0,28,null,'image3')" onMouseOut="MM_startTimeout();"><img src="{$this->tplPath}/images/header_r3_c12.jpg" border="0" width="96" height="33" id="image3" /></a></td>
       <td colspan="2"><img name="header_r3_c13" src="{$this->tplPath}/images/header_r3_c13.jpg" width="4" height="33" border="0" id="header_r3_c13" alt="" /></td>
       <td colspan="2"><a href="0/5/index.html" onMouseOver="MM_showMenu(window.mm_menu_0921211431_0,0,28,null,'image4')" onMouseOut="MM_startTimeout();"><img src="{$this->tplPath}/images/header_r3_c15.jpg" border="0" width="96" id="image4" height="33" /></td>
       <td><img name="header_r3_c17" src="{$this->tplPath}/images/header_r3_c17.jpg" width="4" height="33" border="0" id="header_r3_c17" alt="" /></td>
       <td><img src="{$this->tplPath}/images/header_r3_c18.jpg" border="0" width="120" height="33" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="33" border="0" alt="" /></td>
      </tr>
      <tr>
       <td rowspan="2" colspan="16"><img name="header_r4_c3" src="{$this->tplPath}/images/header_r4_c3.jpg" width="631" height="30" border="0" id="header_r4_c3" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="6" border="0" alt="" /></td>
      </tr>
      <tr>
       <td rowspan="2" colspan="2"><img name="header_r5_c1" src="{$this->tplPath}/images/header_r5_c1.jpg" width="205" height="149" border="0" id="header_r5_c1" alt="" /></td>
       <td rowspan="3"><img name="header_r5_c19" src="{$this->tplPath}/images/header_r5_c19.jpg" width="1" height="150" border="0" id="header_r5_c19" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="24" border="0" alt="" /></td>
      </tr>
      <tr>
       <td colspan="5"><img name="header_r6_c3" src="{$this->tplPath}/images/header_r6_c3.jpg" width="124" height="125" border="0" id="header_r6_c3" alt="" /></td>
       <td colspan="6"><img name="header_r6_c8" src="{$this->tplPath}/images/header_r6_c8.jpg" width="286" height="125" border="0" id="header_r6_c8" alt="" /></td>
       <td colspan="5"><img name="header_r6_c14" src="{$this->tplPath}/images/header_r6_c14.jpg" width="221" height="125" border="0" id="header_r6_c14" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="125" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><img name="header_r7_c1" src="{$this->tplPath}/images/header_r7_c1.jpg" width="7" height="1" border="0" id="header_r7_c1" alt="" /></td>
       <td colspan="2"><img name="header_r7_c2" src="{$this->tplPath}/images/header_r7_c2.jpg" width="221" height="1" border="0" id="header_r7_c2" alt="" /></td>
       <td><img name="header_r7_c4" src="{$this->tplPath}/images/header_r7_c4.jpg" width="6" height="1" border="0" id="header_r7_c4" alt="" /></td>
       <td colspan="14"><img name="header_r7_c5" src="{$this->tplPath}/images/header_r7_c5.jpg" width="602" height="1" border="0" id="header_r7_c5" alt="" /></td>
       <td><img src="{$this->tplPath}/images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
      </tr>
    </table>
    [​IMG]
    附图
     

    附件文件:

    • 111.gif
      111.gif
      文件大小:
      19.3 KB
      浏览:
      33
    #1 lane, 2006-03-24
    最后编辑: 2006-03-24
  2. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    你使用了 居中

    <table border="0" cellpadding="0" cellspacing="0" width="837" align="center">
     
  3. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    暂时只看到了这一个
     
  4. lane

    lane New Member

    注册:
    2005-09-05
    帖子:
    6,548
    赞:
    29
    问题二,有一列表格变窄,字都挤到一起了

    问题二,把字由12px改到14px后,有一列表格变窄,字都挤到一起了
     
  5. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    字改大, 相应的也要把表格的宽度改大一点
     
  6. lane

    lane New Member

    注册:
    2005-09-05
    帖子:
    6,548
    赞:
    29


    居中只是针对这个表格的,不会影响到下面别的表格吧?

    我说的不是header部分,是下面部分,表格是要居中的,只是不想让表格里的字居中。
     
  7. lane

    lane New Member

    注册:
    2005-09-05
    帖子:
    6,548
    赞:
    29
    这个表格的宽度我改不好啊,原来的是没有设置宽度的。
    代码:

    代码:
    $header<br>
    $banner
    <SCRIPT language=JavaScript>
    
    function insertstr(str)
    {
    	document.postForm.brief.value=document.postForm.brief.value+str;
    }
    function btn_q()
    {
     txt=prompt("引用内容:","文字");     
     if(txt!=null)
     {
      AddTxt="
    
    
    
    "; insertstr(AddTxt); } } function btn_email() { txt=prompt("Email:","@"); if(txt!=null) { AddTxt=""+txt; insertstr(AddTxt); AddTxt=""; insertstr(AddTxt); } } function btn_url() { txt=prompt("URL:","http://"); if(txt!=null) { AddTxt=""+txt; insertstr(AddTxt); AddTxt=""; insertstr(AddTxt); } } function btn_swf() { txt=prompt("Flash动画的URL地址:","http://"); if(txt!=null) { AddTxt="[swf width=450 height=280]"+txt; insertstr(AddTxt); AddTxt="[/swf]"; insertstr(AddTxt); } } function btn_img() { txt=prompt("图片的URL地址:","http://"); if(txt!=null) { AddTxt=""+txt; insertstr(AddTxt); AddTxt=""; insertstr(AddTxt); } } function showcolor(color) { txt=prompt("文字颜色:"+color,"文字"); if(txt!=null) { AddTxt="[color="+color+"]"+txt; insertstr(AddTxt); AddTxt="[/color]"; insertstr(AddTxt); } } function btn_i() { txt=prompt("斜体文字:","斜体字"); if (txt!=null) { AddTxt=""+txt; insertstr(AddTxt); AddTxt=""; insertstr(AddTxt); } } function btn_u() { txt=prompt("下划线文字:","下划线文字"); if (txt!=null) { AddTxt=""+txt; insertstr(AddTxt); AddTxt=""; insertstr(AddTxt); } } function btn_b() { txt=prompt("粗体文字:","粗体字"); if (txt!=null) { AddTxt=""+txt; insertstr(AddTxt); AddTxt=""; insertstr(AddTxt); } } function btn_code() { txt=prompt("插入代码:","在此填写代码"); if (txt!=null) { AddTxt="
    代码:
    "+txt;
      insertstr(AddTxt);
      AddTxt="
    "; insertstr(AddTxt); } } </SCRIPT> <script language=javascript> ie = (document.all)? true:false if (ie){ function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.postForm.submit();}} } function submitonce(theform){ //if IE 4+ or NS 6+ if (document.all||document.getElementById){ //screen thru every element in the form, and hunt down "submit" and "reset" for (i=0;i<theform.length;i++){ var tempobj=theform.elements if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") //disable em tempobj.disabled=true } } } </script> <div align="center"> <center> <table border="0" width="837"> <tr> <td width="23%" valign="top">$adminMenu</td> <td width="77%"> <center> <table bgcolor =#006699 cellspacing=1 cellpadding=3 width=95%> <tr bgcolor =#006699> <td colspan = 2 align=center><font color =white>新增/修改文章</font></td> </tr> <tr bgcolor=#ffffff <td> <form action="admin.php?modules=edit" method="POST" name="postForm" enctype="multipart/form-data"> <td align=right>编号:</td> <td><input type=text name=id size=15 value="$id" style='color:#000000; border:0px; background-color: #ffffff' readonly></td> </tr> <tr bgcolor=#efefef> <td align=right>提交者:</td> <td><input type=text name=username size=15 value=$curUser style='color:#000000; border:0px; background-color:#efefef' readonly></td> </tr> <tr bgcolor=#ffffff> <td align=right>文章标题:</td> <td><input type=text name=name size=30 value=$aSoft->name></td> </tr> <tr bgcolor=#efefef> <td align=right>更新日期:</td> <td><input type=text name=date size=20 value=$date></td> </tr> <tr bgcolor=#efefef> <td align=right>文章作者:</td> <td><input type=text name=empower size=20 value=$aSoft->empower></td> </tr> <tr bgcolor=#efefef> <td align=right>推荐程度:</td> <td><select size=1 name=grade> $grade </select></td> </tr> <tr bgcolor=#ffffff> <td align=right>出处:</td> <td><input type=text name=homepage size=50 value=$aSoft->homepage></td> </tr> <tr bgcolor=#efefef> <td align=right>原文连接:</td> <td><input type=text name=demo size=50 value=$aSoft->demo></td> </tr> <tr bgcolor=#ffffff> <td align=right>图片地址:</td> <td><input type=text name=img size=50 value=$aSoft->img></td> </tr> <tr bgcolor=#efefef> <td align=right>文章分类:</td> <td><select size=1 name=sort2id>$category</select></td> </tr> <tr bgcolor=#ffffff> <td align=right>是否推荐:</td> <td>$comment</td> </tr> <tr bgcolor=#efefef> <td align=right>是否显示:</td> <td>$canshow</td> </tr> <tr bgcolor=#ffffff> <td align=right>关键字:</td> <td><input type=text name=keywords size=20 value=$aSoft->keywords></td> </tr> <tr bgcolor=#efefef> <td width=131 valign=top valign=top align=right>文章内容: <br><br>( <font color=red>HTML不支持</font> <br><br> <font color=green>PTB编码支持</font>) </td> <td> <img align=absBottom alt="插入粗体字" onclick=btn_b() src="{$this->tplPath}/images/post/bold.gif" width="23" height="22"> <img align=absBottom alt="插入斜体字" onclick=btn_i() src="{$this->tplPath}/images/post/italicize.gif" width="23" height="22"> <img align=absBottom alt="下划线文字" onclick=btn_u() src="{$this->tplPath}/images/post/underline.gif" width="23" height="22"> <img align=absBottom alt="插入超级链接" onclick=btn_url() src="{$this->tplPath}/images/post/url.gif" width="23" height="22"> <img align=absBottom alt="插入图片" onclick=btn_img() src="{$this->tplPath}/images/post/img.gif" width="23" height="22"> <img align=absBottom alt="插入Flash动画" onclick=btn_swf() src="{$this->tplPath}/images/post/flash.gif" width="23" height="22"> <img align=absBottom alt=插入email onclick=btn_email() src="{$this->tplPath}/images/post/email2.gif" width="23" height="22"> <img align=absBottom alt=插入引用内容 onclick=btn_q() src="{$this->tplPath}/images/post/quote2.gif" width="23" height="22"> <img align=absBottom alt=插入代码 onclick=btn_code() src="{$this->tplPath}/images/post/code.gif" width="23" height="22"> <SELECT class="input5" name=color onchange=showcolor(this.options[this.selectedIndex].value)> <OPTION selected style="COLOR: #cc0099" value=#cc0099>◆深紫◆</OPTION> <OPTION style="COLOR: #009933" value=#009933>◆深绿◆</OPTION> <OPTION style="COLOR: #ff9900" value=#ff9900>◆棕色◆</OPTION> <OPTION style="COLOR: #00cc99" value=#00cc99>◆叶绿◆</OPTION> <OPTION style="COLOR: #ff9999" value=#ff9999>◆粉红◆</OPTION> <OPTION style="COLOR: #cc0066" value=#cc0066>◆深红◆</OPTION> <OPTION style="COLOR: #33ccff" value=#33aaff>◆天蓝◆</OPTION> <OPTION style="COLOR: #330099" value=#330099>◆深蓝◆</OPTION> <OPTION style="COLOR: #333333" value=#333333>◆深灰◆</OPTION></SELECT> <br> <textarea rows=20 name=brief cols=90>$brief</textarea> </td> </tr> <tr bgcolor=#efefef> <td width=492 colspan=2 align=center> <input type=submit value=提交 name={$sendname}> <input type=reset value=重填></td> </form> </tr> </table> </center> </td> </tr> </table> </center> </div>
     
  8. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    还是没明白 你的意思。

    你要是说下部分不要居中的话
    那为什么不 下部份 重新定义CSS ?用个框框起来
     
  9. lane

    lane New Member

    注册:
    2005-09-05
    帖子:
    6,548
    赞:
    29
    恩,我把每一个td里都加入了 align=left ,好了

    现在还有表格宽度没解决
     
  10. lane

    lane New Member

    注册:
    2005-09-05
    帖子:
    6,548
    赞:
    29
    搞定了,是因为文本框的原因,所以调不了。

    十分感谢ling 兄,这几天全靠你了。
     
  11. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
  12. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    你的作品完成后 拿出来我欣赏一下
     
  13. lane

    lane New Member

    注册:
    2005-09-05
    帖子:
    6,548
    赞:
    29
    好的,偶大菜鸟一个~到时候不要笑话偶~