请问我这个表单(id='bottom_form'那个),为什么点击之后没有反应呢?
主要完成的功能是初始时只出现“添加”,添加之后出现id=bottom_form表单,然后点击提交(添加文字变为“提交”),但是点击就是没有反应,action的属性页没有改变。$(function(){
$("#add_btn").toggle(function(){
$("#insert_board").show();
$("#drop_btn").show();
$(this).html("提交");
},function(){
//$("#bottom_form").attr("action","admin_board.php?add="+"yes");
//$("#bottom_form").submit();
$("#form_article").attr('action',"admin_board.php?add="+"yes");
$("#form_article").submit();

$("#insert_board").hide();
$("#drop_btn").hide();
$(this).html("添加");
});

$("#drop_btn").click(function(){
$("#insert_board").hide();
$("#drop_btn").hide();
});

});
</script>
<?php 
if (isset($_GET['add']) && $_GET['add'] == 'yes') {
if ($_POST['board_name'] && $_POST['board_content']) {
$res_board = BoardList::insertBoard(trim($_POST['board_name']),trim($_POST['board_desc']));
if (!$res_board) {
die("插入失败!");
}
}

}
?>
<div id="admin_main">
<ul class="talk_banner">
<li><a href="admin.php">贴子管理</a></li><li><a href='admin_heroes.php'>发帖排行</a></li><li>
<a href='admin_userinfo.php'>用户管理</a></li>
    
<li ><a id="delete_restore" class="hover">删除/恢复</a></li>  
<li ><a id="delete_all" class="hover">全部删除</a></li>  
<li ><a id="restore_all" class="hover">全部恢复</a></li>
</ul>
<form id="form_board" name="board" 
action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" method="post">
<?php $boardArr = BoardList::get_allBoard();
?>
<table>
<tr><th></th><th>名称</th><th>简介</th><th>创建时间</th><th>可见/删除</th></tr>
<?php for($i=0;$i<count($boardArr);$i++){
$bgcolor=($i%2) ? '#ffffff' : 'e0e0e0';?>
<tr bgcolor="<?php echo $bgcolor?>"><td><input type="checkbox" name="ids[]" id="ids" /></td><td><?php echo $boardArr[$i]['f_name'];?></td>
<td><?php echo $boardArr[$i]['f_desc']?></td><td><?php echo $boardArr[$i]['f_desc']?></td>
<td><?php echo $boardArr[$i]['f_created_time']?></td>
<td><?php 
if ($boardArr[$i]['f_enabled']) {
$img='../images/yes.gif';
}else {
$img='../images/no.gif';
}
?><img src="<?php echo $img?>" /></td>
</tr>
<?php }?>
</table>
<div id="insert_board"  style="display:none;">
<form name="bottom_form" id="bottom_form" method="post" action="">
<label for="board_name">名称:</label><input name="board_name" type="text" value="<?php echo $_POST['board_name'];?>" size="25" /><br/>
<label for="board_content">简介:</label><textarea name="board_content" cols="40" rows="8" id="board_content"><?php echo $_POST['board_content']; ?></textarea>
</form>
</div>
<p><center><a id="add_btn" class="hover">添加</a>    <a id="drop_btn" class="hover" style="display:none;">取消</a></center></p>

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Untitled Page</title>
        <script type="text/javascript" src="jquery-1.6.1.js"></script>
    <script type="text/javascript">
       
    $(function(){
    $("#add_btn").toggle(function(){
       $("#insert_board").show();
       $("#drop_btn").show();
       $(this).html("提交");
    },function(){
       $("#bottom_form").attr('action',"admin_board.php?add="+"yes");
       $("#bottom_form").submit();
       
       $("#insert_board").hide();
       $("#drop_btn").hide();
       $(this).html("添加");
    });
       
       $("#drop_btn").click(function(){
          $("#insert_board").hide();
          $("#drop_btn").hide();
       });
    });
    </script>
    </head>
    <body>  
    <div id="insert_board" style="display:none;">
    <form name="bottom_form" id="bottom_form" method="post" action="">
    <label for="board_name">名称:</label><input name="board_name" type="text" value="<?php echo $_POST['board_name'];?>" size="25" /><br/>
    <label for="board_content">简介:</label><textarea name="board_content" cols="40" rows="8" id="board_content"><?php echo $_POST['board_content']; ?></textarea>
    </form>
    </div>
    <p><center><a id="add_btn" class="hover">添加</a> <a id="drop_btn" class="hover" style="display:none;">取消</a></center></p>
    </body>
    </html>
    你form_article是哪个表单呢?