0
您好有一个jQuery驱动的小型表单。它可以在90%的页面上正常工作,但在两页上,“提交”按钮不对齐。我检查了工作和非工作页面上的html和jquery,看不出有什么不同。我希望看到另一组人眼看看是什么导致提交按钮离得太远。为什么相同的代码在不同的页面显示不同?
这里是一个工作页面(滚动至底部,报注册表格):view page
这里是页面,它不能正常工作:view page
下面是形式的HTML:
<div id="news-signup">
<div id="entry">
<input type="text" id="your-email" name="your-email" value="YOUR EMAIL ADDRESS" onfocus="if (this.value=='YOUR EMAIL ADDRESS') this.value='';" />
<input type="submit" value="::Submit Query::" id="red-submit" />
</div>
</div>
这里是不会掉出的jQuery:
$(document).ready(function() {
var emailInput = $("#your-email");
emailInput.focus(function() {
// THREE = !
if(this.value === "YOUR EMAIL ADDRESS") {
this.value = "";
}
});
emailInput.blur(function() {
if(this.value === "") {
this.value = "YOUR EMAIL ADDRESS";
}
});
$("#red-submit").click(function() {
$.ajax({
type: 'POST',
url: 'news.php',
data: {
'your-email': emailInput.val()
},
success: function() {
var image = $('<img />').attr({src:'_images/register-thanks.png', width:332, height:35, alt:"Success"});
$('#news-signup input').hide();
$('#news-signup').append(image);
}
});
});
});
这里是CSS定位:
#news-signup #entry,
#news-signup form {
width:335px;
height:35px;
position: absolute;
top: 52px;
left: 590px;
}
#news-signup input#your-email {
width: 195px;
height: 20px;
position: relative;
top: 5px;
left: 0;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #cbcbcb;
font: 14px "Trebuchet MS", Helvetica, sans-serif;
color: #cbcbcb;
}
#news-signup img { position: absolute; top: 50px; left: 600px; }
input#red-submit {
width: 90px;
height: 30px;
border-style: none;
text-indent: -9999px;
position: relative;
top: -20px;
left: 250px;
cursor: pointer;
font-size: 0;
line-height: 0;
background-color: transparent;
background-image: url(../_images/btn_submit-red.png);
}
感谢您的帮助!
这里有一些奇怪的隐藏角色,我不确定它是什么,但是修复了它。 – fmz 2010-10-22 17:59:59