[json]js 常用代码

时间:2015-01-12  来源:常用代码  阅读:

71.禁止选择页面上的文字来拷贝
<script>
function noEffect() {
  with (event) {
    returnValue = false;
    cancelBubble = true;
  }
  return;
}
</script>
//

72.屏蔽右键菜单
oncontextmenu="event.returnValue = false"//

73.事件禁止起泡
event.cancelBubble = true//

74.禁止在输入框打开输入法
//

75.屏蔽汉字和空格
//

76.用javascript判断文件是否存在
function Exists(filespec)
{
 if (filespec)
 {
  var fso;
  fso = new ActiveXObject("Scripting.FileSystemObject");
  alert(fso.FileExists(filespec));
 }
}
选择图片


//

获得当前的行是表格的第几行
<script>
function getrow(obj)
{
   if(event.srcElement.tagName=="TD"){
   curRow=event.srcElement.parentElement;
   alert("这是第"+(curRow.rowIndex+1)+"行");

   }
}
</script>


 
     
     
     
     
     
 
 
     
     
     
     
     
 
//

80.删除表格某行,xx表示某行,下标从0开始计算
document.all.myTable.deleteRow(xx)//

81.动态的向表格中添加行


<script language="JavaScript">
function add()
{
   t1.insertRow().insertCell().innerHTML = "";
}//

 

82.event.x,event.clientX,event.offsetX区别:
x:设置或者是得到鼠标相对于目标事件的父元素的外边界在x坐标上的位置。 clientX:相对于客户区域的x坐标位置,不

包括滚动条,就是正文区域。 offsetx:设置或者是得到鼠标相对于目标事件的父元素的内边界在x坐标上的位置。
screenX:相对于用户屏幕。

 
83.显示是鼠标按钮的哪个
点Mouse看看//

[json]js 常用代码

http://m.bbyears.com/css/12160.html

推荐访问:json格式化 json在线格式化 js格式化 js刷新当前页面 jsp js保留两位小数
相关阅读 猜你喜欢
本类排行 本类最新