手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >html组件不可输入(只读)同时任何组件都有效
html组件不可输入(只读)同时任何组件都有效
摘要:复制代码代码如下:/***将页面设置为只读*/varsetReadOnly=function(){varinput=$("input");i...

复制代码 代码如下:

/**

* 将页面设置为只读

*/

var setReadOnly = function()

{

var input = $("input");

input.each(function(i)

{

$(this).attr("onfocus", "this.blur();return false;");

$(this).wrap(function()

{

return '<span onmousemove="this.setCapture();" onmouseout="this.releaseCapture();" />';

});

});

var select = $("select");

select.each(function(i)

{

$(this).attr("onfocus", "this.blur();return false;");

$(this).wrap(function()

{

return '<span onmousemove="this.setCapture();" onmouseout="this.releaseCapture();" />';

});

});

var textarea = $("textarea");

textarea.each(function(i)

{

$(this).attr("onfocus", "this.blur();return false;");

$(this).wrap(function()

{

return '<span onmousemove="this.setCapture();" onmouseout="this.releaseCapture();" />';

});

});

var img = $("img");

img.each(function(i)

{

$(this).attr("onfocus", "this.blur();return false;");

$(this).wrap(function()

{

return '<span onmousemove="this.setCapture();" onmouseout="this.releaseCapture();" />';

});

});

}

【html组件不可输入(只读)同时任何组件都有效】相关文章:

Prototype1.4手册

接收键盘指令的脚本

简述JavaScript中正则表达式的使用方法

html下载本地

全面详细的jQuery常见开发技巧手册

JQuery中DOM实现事件移除的方法

JQuery中DOM事件合成用法实例分析

利用js实现禁止复制文本信息

安装使用Mongoose配合Node.js操作MongoDB的基础教程

JavaScript中的anchor()方法使用详解

精品推荐
分类导航