2010-01-23 29 views
0

褪色這裏是我迄今爲止,但事情並沒有真正的工作。 (我拖着的jquery.js文件從Solution Explorer到我的HTML的區域。我該如何使用jQuery來使驗證圖標稍微顯得有些緩慢,在

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SignUpFormTest._Default" %> 

<!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 runat="server"> 
    <title></title> 
    <script src="Scripts/jquery-1.4.min.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      //fade in the context of whatever is inside the div tag. 
      $('#name').fadeIn("slow"); 
     }); 
    </script> 
</head> 

<body bgcolor="#FFFFFF"> 

<p> 
Note that this form doesn't actually do anything 
except illustrate the Required Field Validator. 
</p> 

<form id="frmValidator" action="required.aspx" method="post" runat="server"> 

    Enter Your Name: 
    <asp:TextBox id="txtName" runat="server" /> 
    <div id="name"><asp:RequiredFieldValidator id="valTxtName" ControlToValidate="txtName" ErrorMessage='<img src="../Images/no.png">' runat="server" /></div> 

    <br /> 
    <asp:button id="btnSubmit" text="Submit" runat="server" /> 

</form> 
<p> 
Hint: Try submitting it before you enter something. 
</p> 
</body> 


</html> 

當驗證圖標只是彈出。

在不褪色或任何東西。另外,我知道我目前的解決方案是哈克,所以我真的希望有人告訴我,我應該做的,而不是隻爲一個動畫的目的,創造一個DIV標籤的內容。

回答

0

確保和借鑑E要jQuery是有效的,並使用此代碼:如果我沒有記錯,因爲DIV是你的情況,jQuery將不會掉色它已經可見

$(document).ready(function() { 
    $('#name').hide().fadeIn("slow"); 
}); 

hide()方法確保DIV最初不可見,然後慢慢消失。

0
$(document).ready(function() { 
document.getElementById('valTxtName').onpropertychange = function(){ 
      $('#name').fadeIn("slow"); 
} 

}); 
+0

這仍然使它彈出。 – 2010-01-23 12:07:45

相關問題