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

html代码调试脚本

JQuery自动触发事件的方法

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

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

由ReactJS的Hello world说开来

html下载本地

js实现div层缓慢收缩与展开的方法

jQuery实现dialog设置focus焦点的方法

javascript实现淡蓝色的鼠标拖动选择框实例

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

精品推荐
分类导航