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

CSS+JS实现点击文字弹出定时自动关闭DIV层菜单的方法

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

卡拉 OK 字幕效果

html下载本地

JQuery自动触发事件的方法

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

nextSibling

JavaScript中的parse()方法使用简介

由ReactJS的Hello world说开来

javascript中CheckBox全选终极方案

精品推荐
分类导航