Home > Backend Development > PHP Tutorial > 为啥这个页面点“提交”没反应呢

为啥这个页面点“提交”没反应呢

WBOY
Release: 2016-06-13 12:08:55
Original
1522 people have browsed it

为什么这个页面点“提交”没反应呢?
后台某页面index.html

<br /><html><br />    <head><br />    <script language="JavaScript" src="__PUBLIC__/backend/ueditor/ueditor.config.js" ></script><br />    <script language="JavaScript" src="__PUBLIC__/backend/ueditor/ueditor.all.js" ></script><br />    <script language="JavaScript" src="__PUBLIC__/backend/ueditor/ueditor.all.min.js" ></script><br /></head><br /><body><br />    <div class="wrap"><br />        <div class="nav"><br />            <ul class="cc"><br />                <li class="current"><a href="javascript:void(0);">网站基本信息</a></li><br />            </ul><br />        </div><br />        <form class="J_ajaxForm" id="J_Form" enctype="mutipart/form-data"  method="post" action="{:U('Web/update')}" ><br />            <input type="hidden" name="nid" value="{$web.id}" /><br />            <div class="h_a"><?php if(empty($web)):?>新增<?php else:?>编辑<?php endif;?>网站</div><br />            <div class="table_full"><br />                <table width="100%" class="J_check_wrap"><br />                    <col class="th" /><br />                    <col width="400" /><br />                    <col /><br />                    <tr><br />                        <th>网站名称</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.webname}" name="name" /><br />                        </td><br />                    </tr><br />                    <tr><br />                        <th>网站标题</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.webtitle}" name="title" /><br />                        </td><br />                    </tr><br />                    <tr><br />                        <th>网站关键字</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="60" class="input input_hd length_5" data-rules="{required:true}" value="{$web.webkeyword}" name="key" /><br />                        </td><br />                    </tr><br /><br />                    <tr><br />                        <th>网站网址</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.weburl}" name="url" /><br />                        </td><br />                    </tr><br /><br />                    <tr><br />                        <th>公司名称</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.comname}" name="cname" /><br />                        </td><br />                    </tr><br />                    <tr><br />                        <th>公司地址</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.comaddress}" name="address" /><br />                        </td><br />                    </tr><br />                    <tr><br />                        <th>公司电话</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.comtelnum}" name="tel" /><br />                        </td><br />                    </tr><br />                    <tr><br />                        <th>公司传真</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.comfax}" name="fax" /><br />                        </td><br />                    </tr><br />                    <tr><br />                        <th>公司400电话</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5"   value="{$web.freephone}" name="phone" /><br />                        </td><br />                    </tr><br />                    <tr><br />                    <tr><br />                        <th>公司邮箱</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.comemail}" name="mail" /><br />                        </td><br />                    </tr><br /><br />                    <tr><br />                        <th>网站备案信息</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.copyright}" name="right" /><br />                        </td><br />                    </tr><br />                    <tr><br />                        <th>客服QQ</th><br />                        <td colspan="5"><br />                            <span class="must_red">*</span><br />                            <input type="text" maxlength="20" class="input input_hd length_5" data-rules="{required:true}" value="{$web.server_qq}" name="qq" /><br />                        </td><br />                    </tr><br />                    <tr><br />                        <th>网站内容</th><br />                        <td colspan="5"><br />                            <textarea id="editor"   name="tont">{$web.new_notice}</textarea><script>UE.getEditor('editor');</script><br />                        </td><br />                    </tr><br />                </table><br />                <div class="btn_wrap"><br />                    <div class="btn_wrap_pd"><br />                        <button type="submit" class="btn btn_submit mr15">提交</button><br />                    </div><br />                </div><br />            </div><br />        </form><br />    </div><br /><br /><include file="Home:Public:footer" /><br /><script type="text/javascript"><br />    BUI.use('bui/form', function(Form) {<br />        var form = new Form.HForm({<br />            srcNode: '#J_Form'<br />        });<br />        form.render();<br />    });<br /></script><br /><script type="text/javascript"><br />    $(function() {<br />        $(':checkbox').click(function() {<br />            $("#" + $(this).attr('pid')).attr('checked', true);<br />            $("#" + $(this).attr('gpid')).attr('checked', true);<br />            var id = $(this).attr('id');<br /><br />            var inputs = $('input[pid=' + id + ']');<br />            $(this).attr('checked') ? inputs.attr('checked', true) : inputs.attr('checked', false);<br /><br />            var ginputs = $('input[gpid=' + id + ']');<br />            $(this).attr('checked') ? ginputs.attr('checked', true) : ginputs.attr('checked', false);<br />        });<br />    });<br /></script><br /></body><br /></html><br />
Copy after login


对应的PHP代码WebAction.class.php:
<br /><?php<br /><br />class WebAction extends BaseAction {<br /><br />    /**<br />     * 显示在页面 smarty注入<br />     */<br />    public function index() {<br />        $this->checkAccess('team');<br />// 		$this->assign("news",$this->fNews());<br />//	        $this->fNews();<br />// 		$this->assign("oneNews",$this->fOneNews());<br />        $this->display();<br />    }<br /><br />    /**<br />     * 查询网站基本信息<br />     * @return Ambigous <mixed, string, boolean, NULL, unknown, multitype:, multitype:multitype: , void, object><br />     */<br />    public function find() {<br />        $this->checkAccess('team');<br />        $m = M("web");<br /><br />        $web = $m->find();<br />        $this->assign("web", $web); //赋值数据集<br /><br />        $this->display("Web/index");<br />    }<br /><br />    /**<br />     * 查询进入帮助中心显示的文章<br />     * @return Ambigous <mixed, string, boolean, NULL, unknown, multitype:, multitype:multitype: , void, object><br />     */<br />    public function fOneNews() {<br />        $this->checkAccess('team');<br />        $type['id'] = $_GET['id'] ? $_GET['id'] : 1; //二元运算 如果 存在$_GET['id'] 赋值本身 不存在为假赋值为1<br /><br />        $oneNews = M("news")->where($type)->select();<br />        return $oneNews;	<br />    }<br /><br />    /**<br />     * 跳转到添加文章分类页面<br />     */<br />    public function create() {<br />        $this->checkAccess('team');<br />        $nType = new NewListAction();<br />        $webType = $nType->fNewsType();<br />        $this->assign("newsType", $webType);<br />        $this->display("News:newsFrom");<br />    }<br /><br />    public function update() {     <br /><?php<br /><br />class WebAction extends BaseAction {<br /><br />    public function index() {<br />        $this->checkAccess('team');<br />// 		$this->assign("news",$this->fNews());<br />//	        $this->fNews();<br />// 		$this->assign("oneNews",$this->fOneNews());<br />        $this->display();<br />    }<br /><br />    public function find() {<br />        $this->checkAccess('team');<br />        $m = M("web");<br /><br />        $web = $m->find();<br />        $this->assign("web", $web); //赋值数据集<br /><br />        $this->display("Web/index");<br />    }<br /><br />    public function fOneNews() {<br />        $this->checkAccess('team');<br />        $type['id'] = $_GET['id'] ? $_GET['id'] : 1; //二元运算 如果 存在$_GET['id'] 赋值本身 不存在为假赋值为1<br /><br />        $oneNews = M("news")->where($type)->select();<br />        return $oneNews;	<br />    }<br /><br />    public function create() {<br />        $this->checkAccess('team');<br />        $nType = new NewListAction();<br />        $webType = $nType->fNewsType();<br />        $this->assign("newsType", $webType);<br />        $this->display("News:newsFrom");<br />    }<br /><br />    public function update() {      <br />        $this->checkAccess('team');<br />        $where['id'] = I('nid', '', 'trim'); //网站名称 <br />		<br />        $web['webname'] = I('name', '', 'trim'); //网站名称<br />        ...<br /> <br />        $add = M("Web");<br />         //	$add->create($web) <br />        $result = $add->where($where)->save($web);<br /><br />        if ($result) { <br />            $this->success("操作成功!");<br />        } else { <br />            $this->error("操作失败");<br />        }<br />    }<br />}<br />
Copy after login


经跟踪,点击“提交”后,WebAction.class.php中的update()并没有被执行,这是怎么回事呢?
------解决思路----------------------


这两个应该只要一个,可能会产生冲突
------解决思路----------------------
可以在firebug控制台下看看有没有报错。
------解决思路----------------------
清理下IE的缓存在看看。
------解决思路----------------------
通过firebug追踪下执行的url地址,断点调试,看返回什么内容。
------解决思路----------------------
引用:
Quote: 引用:

通过firebug追踪下执行的url地址,断点调试,看返回什么内容。


清理下IE的缓存,刷新后也还是一样。
firebug追踪里的javascipt代码有很多个,全在一行里,设断点也无法跟踪到什么东西 :(

图片中的【所有 jquery.js?v20130702】后面有个花括号,点一下有惊喜
------解决思路----------------------
IE中可以开调试查看一下
注意:
<br />[1,<br />2,<br />3,<br />]<br />
Copy after login

这种在低版本的IE中是错误的写法
------解决思路----------------------
TP的项目可能性就是JS冲突

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template