永远点不到的按钮 && 鼠标经过边框自动边框变色

来源:互联网 发布:计量经济学论文数据 编辑:程序博客网 时间:2024/05/01 19:43
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title><script type="text/javascript" src="jquery-1.4.js"></script><script type="text/javascript">var mask,currInput;$(function(){var height = $(window).height();var width = $(window).width();$('#x').mouseover(function(){var randHeight = height / 2 - (Math.random() * 200);var randWidth = width / 2 -  (Math.random() * 200);$(this).css('top',randHeight)$(this).css('left',randWidth)});$('input:not(button)').mouseover(function(){currInput = $(this);mask = setTimeout(randomInputBorderColor,100);});$('input:not(button)').mouseout(function(){clearTimeout(mask);});});function randomInputBorderColor () {var randomColor = parseInt(Math.random() * 10000);$(currInput).css('border-color','#' + randomColor);mask = setTimeout(randomInputBorderColor,100);}</script></head><body><input value="admin" type="text" style="position: absolute;top: 40%;left: 40%;width: 10%" /><input value="admin" type="password" style="position: absolute;top: 45%;left: 40%;width: 10%" /><input id="x" value="提交" type="button" style="position: absolute;top: 50%;left: 40%;" /></body></html>



需要 jQuery 。