此文章由 atransformer 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 atransformer 所有!转贴必须注明作者、出处和本声明,并保持内容完整
<html>
<head>
<style type="text/css">
.HighLight
{
background-color:Yellow;
}
#Text_Special
{
width: 500px;
}
.Hidden
{
display:none;
}
</style>
</head>
<body>
<div>
<input id="Text0" type="text" />
<br />
<input id="Text_Special" type="text" class="special" />
<div id="HiddenDiv" class="special">
<ul class="special">
<li class="special">Frank is a bad man.</li>
<li class="special">Frank is not a good man.</li>
<li class="special">Frank is not a man.</li>
</ul>
</div>
<br />
<input id="Text2" type="text" />
<br />
<input id="Text3" type="text" />
<br />
<input id="Text4" type="text" />
<br />
<input id="Text5" type="text" />
<br />
<input id="Text6" type="text" />
</div>
<script type="text/javascript" src="jquery-1.7.1.min.js"> </script>
<script type="text/javascript">
$(document).ready(function () {
$("#HiddenDiv").addClass('Hidden');
$("*").focus(function () {
if ($(this).is('.special')) {
$("#HiddenDiv").removeClass('Hidden');
}
else {
$("#HiddenDiv").addClass('Hidden');
}
});
$("li").mouseout(function () {
$(this).removeClass('HighLight');
}).mouseover(function () {
$(this).addClass('HighLight');
}).click(function () {
$('#Text_Special').val($(this).text());
});
});
</script>
</body>
</html>
[ 本帖最后由 atransformer 于 2012-3-2 08:45 编辑 ] |