我有一个javasccript功能,显示或隐藏“跨越”,当用户填写表单,当我点击输入显示的提示:注册一个点击,除了某一个元素
function prepareInputsForHints() {
var inputs = document.getElementsByTagName("input");
for (var i=0; i<inputs.length; i++){
// test to see if the hint span exists first
if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
// the span exists! on focus, show the hint
inputs[i].onfocus = function() {
this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
}
// when the cursor moves away from the field, hide the hint
inputs[i].onblur = function() {
this.parentNode.getElementsByTagName("span")[0].style.display = "none";
}
}
}
}
我的问题是,当我尝试添加链接到提示文本,用户不能点击它,因为它首先注册onblur事件并提示消失,所以我想知道如何修改此功能,以便它不会隐藏,当我点击暗示。
我把这个内循环,但跨度显示不出来人现在都,尝试了几种变化,但我真的很新的这一点,也许你能告诉我整个prepareInputsForHints()函数应该如何看起来像 – 2011-12-15 13:51:08