手机
当前位置:查字典教程网 >编程开发 >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下载本地

Prototype1.4手册

卡拉 OK 字幕效果

可输入的下拉框

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

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

浅谈jQuery中replace()方法

html代码调试脚本

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

angular2使用简单介绍

精品推荐
分类导航