Jquery 光标移动input 为空改变按钮内容

Jquery 光标移动input 为空改变按钮内容

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />论文网 

<script type="text/javascript">

       
            $(document).ready(function(){
               
                $("#update_un_show").prop('disabled', true);
                $("#update_lu").prop('disabled', true);

            });
           
           
            $(document).ready(function(){
            $.datepicker.setDefaults($.datepicker.regional['nl']);
$.datepicker.setDefaults({ dateFormat: 'yy-mm-dd' });
  $(function() {
    $( "#datepicker" ).datepicker();
    $( "#format" ).change(function() {
    
    $('.datepicker').datepicker();

    });
  });
});

$(document).ready(function(){
$("#update_fn").blur(function(){
//alert("hello world");
 var fn=$("#update_fn");
if(fn.val()==""){
   
    $('#fnmsg').html('Require');
    $('#button_submit').html=("heheheeh");//........................................用不了....HERE!!!
   
}
else {$('#fnmsg').html('');}

});

$("#update_ln").blur(function(){
var ln=$("#update_ln");
if(ln.val()==""){
   
    $('#lnmsg').html('Require');
   
//  $('#updatebtn').html=("<button value='Modifyfade'>");//。。。我想要的。。。。。。。。
   
}
else {$('#lnmsg').html('');}

});

});
   
           
       
</script>
<?php
 include_once('db.php');
 


?>

<h2>My Page</h2>
<?php
$a=1;
    if($a!=0){
       
        //echo $_SESSION['ul'];
        echo "<form action='' method='POST' id='valiform'>";
        //echo "<input type='hidden' name='update_un_show' id='validation_un' value='".$_SESSION['un']."'>";
        echo "<center>";
        echo "<table height='350' width='400'>";
        //echo "working";
   
        echo "<tr>";
        echo "<td  align='right'>";
        echo "Username:   ";
        echo "</td>";
        echo "<td>";
        echo "<input type='text' name='update_un_show' id='update_un_show' value='".$_SESSION['un']."'><br>";
        echo "</td>";
        echo "</tr>";
       
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'> *</font>First Name:  ";
        echo "</td>";
        echo "<td>";
        echo" <input type='text' id='update_fn' name='update_fn' value='".$arr2[FName]."'> <span style='color:red;' id='fnmsg'></span>";
        echo "</td>";
        echo "</tr>";
       
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'> </font>Middle Name:  ";
        echo "</td>";
        echo "<td>";
        echo" <input type='text' id='update_mn' name='update_mn' value='".$arr2[MName]."'>";
        echo "</td>";
        echo "</tr>";
               
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'>*</font>Last Name:  ";
        echo "</td>";
        echo "<td>";
        echo" <input type='text' id='update_ln' name='update_ln' value='".$arr2[LName]."'> <span style='color:red;' id='lnmsg'></span>";
        echo "</td>";
        echo "</tr>";
       
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'>*</font>Date of Birth:  ";
        echo "</td>";
        echo "<td>";
        echo " <input type='text' id='datepicker' name='update_dob' value='".$arr2[Birthdate]."'/>";
        echo "</td>";
        echo "</tr>";
       
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'>*</font>Email:  ";
        echo "</td>";
        echo "<td>";
        echo" <input type='text' id='update_em' name='update_em' size='30' value='".$arr2[Email]."'>";
        echo "</td>";
        echo "</tr>";
       
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'> </font>Phone:  ";
        echo "</td>";
        echo "<td>";
        echo" <input type='text' id='update_ph' name='update_ph' value='".$arr2[Phone]."'>";
        echo "</td>";
        echo "</tr>";
       
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'></font>Website:  ";
        echo "</td>";
        echo "<td>";
        echo" <input type='text' id='update_ws' name='update_ws' size='30'  value='".$arr2[Website]."'>";
       
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'>*</font>Affliation:  ";
        echo "</td>";
        echo "<td>";
        echo" <input type='text' id='update_afl' name='update_afl' size='30' value='".$arr2[Affli]."'> <span style='color:red;' id='aflmsg'></span>";
        echo "</td>";
        echo "</tr>";
        echo "</td>";
        echo "</tr>";
       
        echo "<tr>";
        echo "<td align='right'>";
        echo "<font color='#CC0000'></font>Last Updated:  ";
        echo "</td>";
        echo "<td>";
        echo" <input type='text' id='update_lu' name='update_lu' value='".$arr2[Updated_date]."' size='30'>";
        echo "</td>";
        echo "</tr>";
   
        echo "</form>";
        echo "</table>";
         echo '<span id="button_submit"><input type="submit" value="Modify" name="updatedata" id="updatebtn"> </span>';
         echo '<input type="reset" value="Reset" >';
        //echo "<div id='msg'  style='color:red;'>".$msg."</div>";
        echo "</center>";
       
       
        }
    else{
       
        //echo $_SESSION['ul'];
       
        echo '<meta http-equiv="refresh" content="0; url=index.php" />';
        echo "<p style='color:red;'>You do not have access to this page.</p>";
        echo "<a href=".$rootPath."index.php>Go back home page</a>";
       
        }
   
    vacloseConnection() ;  
?>

<br><br><br>
<p1></p1>

我写了一段验证表单的代码,刚开始写,其中有的元素是不能空的 我现在只做了First Name 和last name 的 已经实现了提醒,然后我的想法是当 这些为空的时候 把input submit换成一个光有样子没有用处的button 可是不知道为什么 那段jquery不能改变<span id="button_submit"> 的内容~请高手帮忙看看,谢谢!!!看着很长其实只有 script部分和 95行 还有 73行是重点:)

$("selector").html("content");

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有