嘿傢伙我有JS後續代碼:jQuery的事件不工作在JavaScript
$(document).ready(function(){
$(".replyLink").click(function(){
$("#form-to-"+this.id).html(htmlForm()).toggle(500);
return false;
});
function htmlForm(){
var html;
html ='<form class="comment-form" id="form-post" action="request.php" method="post">';
html +='<input type="hidden" name="post_id" value="" />';
html +='<input type="hidden" name="reply" value="" />';
html +='<table><tr><td>Name:</td><td>';
html +='<input class="name" type="text" name="name" size="20" maxlength="30"/>';
html += ......
return html;
}
//this is not working!//////////////////////////////////////////
$(".comment-form input,.comment-form textarea").focus(function(){
$(this).css({
'background-color': 'white',
'border':'1px solid #3faefc',
'box-shadow': '0px 0px 2px 1px #95d3ff'
});
});
/////////////////////////////////////////////////////////////
});
HTML我有鏈接,例如:
<a href='#' class="replyLink">Reply</a>
,當我點擊這個形式切換「某處」,但我不能用html代碼來控制htmlForm()的代碼! TNX
哇謝謝你它的工作:)關於 – 2012-02-03 22:51:00
嗯,你能告訴我如何設置爲attr htmlForm()該特定元素的形式 - [ID]的ID? – 2012-02-05 13:33:33