右键菜单屏蔽 和 复制到剪贴板 的javascript
<body marginwidth="0" marginheight="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"> function copyText(){ var targetText = document.getElementById('url'); var clipeText = targetText.createTextRange(); clipeText.execCommand("Copy"); alert("复制成功,
js cookie操作
cookieObj=function(){}cookieObj.prototype.clearCookie = function() {var now = new Date();var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);this.setCookie('co'+this.obj, 'cookieValue', yesterday);this.setCookie('cs'+this.obj, 'cookieValue', yesterday);};// [Cookie] Sets value in a cookiecookieObj.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {document.cookie =escape(cookieName) + '=' + escape(cookieValue)+ (expires ? '; expires=' + expires.toGM
jsquery简单体验
http://www.javaeye.com/topic/34087Jquery是继prototype之后又一个优秀的Javascript框架。对prototype我使用不多,简单了解过。但使用上jquery之后,马上被她的优雅吸引住了。有人使用这样的一比喻来比较prototype和jquery:prototype就像Java,而jquery就像ruby.实际上我比较喜欢java(少接触Ruby罢了)但是jquery的简单的实用的确有相当大的吸引力啊!在项目里我把jquery作为自已唯一的框架类包。使用其间也有一点点心得,其实这些心得,在jquery的文档上面也可能有讲,不过还是记下来,以备忘罢。 一,找到你了! 还记得$()这个东西吧
prototype.js函数介绍
函数名解释举例Element.toggle交替隐藏或显示Element.toggle(''div1'',''div2'')Element.hide隐藏Element.hide(''div1'',''div2'')Element.show显示Element.show(''div1'',''div2'')Element.remove删除Element.remove(''div1'',''div2'')Element.getHeight取得高度Element.getHeight(''div1'')Toggle.display和Element.toggle相同Toggle.display(''div1'',''div2'')Insertion.Before在DIV前插入文字Insertion.Before(''div1'',''my content'')Insertion.After在DIV后插入文字Insertion.After(''div1'',''my content'')Insertion.Top在DIV里
javascript事件查询综合
click() 对象.click() 使对象被点击。closed 对象.closed 对象窗口是否已关闭true/falseclearTimeout(对象) 清除已设置的setTimeout对象clearInterval(对象) 清除已设置的setInterval对象confirm("提示信息") 弹出确认框,确定返回true取消返回falsecursor:样式 更改鼠标样式 hand crosshair text wait help default auto e/s/w/n-resizeevent.clientX 返回最后一次点击鼠标X坐标值;event.clientY 返回最后一次点击鼠标Y坐标值;event.offsetX 返回当前鼠标悬停X坐标值event.offsetY 返回当前鼠标悬停Y坐标值docu
js读取xml文件,用了Microsoft.XMLDOM
<script language="javascript">/**载入xml文件生成xml对象返回**/loadXML = function(xmlFile) { var xmlDoc; if(window.ActiveXObject) { xmlDoc = new ActiveXObject('Microsoft.XMLDOM'); xmlDoc.async = false; xmlDoc.load(xmlFile); } else if (document.implementation&&document.implementation.createDocument) { xmlDoc = document.implementation.createDocument('', '', null); xmlDoc.load(xmlFile); } else
js 做网页右键菜单
<style><!--.fifteenth{ position:absolute; width:165px; border:2px solid black; background-color:menu;font-family:'Courier New', Courier,mono; line-height:21px; cursor:default; font-size:12px; z-index:99; visibility:hidden;}.sixteenth{padding-left:12px;padding-right:11px;}--></style><title></title></head><body><div id='first2' class='fifteenth' onMouseover='fifteenth3(event)' onMouseout='eighteenth3(event)' onClick='nineteenth3(event)' display:none>