html组件不可输入(只读)同时任何组件都有效
代码如下:
/**
* 将页面设置为只读
*/
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();" onmouut="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();" />';
});
});
}
上一篇: 癞蛤蟆想吃天鹅肉歇后语
下一篇: 螃蟹过街的歇后语