手机
当前位置:查字典教程网 >编程开发 >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组件不可输入(只读)同时任何组件都有效】相关文章:

jQuery实现将页面上HTML标签换成另外标签的方法

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

用户输入密码的强度

接收键盘指令的脚本

Prototype1.4手册

javascript中DOM复选框选择用法实例

浅谈jQuery中replace()方法

JQuery自动触发事件的方法

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

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

精品推荐
分类导航