禁止右键点击
隐藏搜索文本框文字
获得鼠标指针XY值
验证元素是否为空
jQuery延时加载功能
http://developer.51cto.com/art/201011/232413_2.htm
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false; });
});
</script>
隐藏搜索文本框文字
$(document).ready(function() { $("input.text1").val("Enter your search text here"); textFill($('input.text1')); }); function textFill(input){ //input focus text function var originalvalue = input.val(); input.focus( function(){ if( $.trim(input.val()) == originalvalue ){ input.val(''); } }); input.blur( function(){ if( $.trim(input.val()) == '' ){ input.val(originalvalue); } }); }
获得鼠标指针XY值
$(document).ready(function() { $().mousemove(function(e){ //display the x and y axis values inside the div with the id XY $('#XY').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY); }); // how to use <DIV id=XY></DIV> });
验证元素是否为空
$(document).ready(function() { if ($('#id').html()) { // do something } });
jQuery延时加载功能
$(document).ready(function() { window.setTimeout(function() { // do something }, 1000); });
http://developer.51cto.com/art/201011/232413_2.htm