您现在的位置是:首页 > 电脑技术查询 > web开发

document.write使用解决方案

编辑:chaxungu时间:2022-10-10 23:24:19分类:web开发

document.write使用

var_write=document.write;
_write("helloworld");//为什么这里显示illegalinvocatoin

------解决方案--------------------
非法调用!一般可写成这样
vard=document;
d.write('helloworld');

function_r(str){document.write(str)}
_r('helloworld');

write是document的一定方法,不能像对象一样缓存,每次调用完就完了。
------解决方案--------------------
with(document){
writer(str);
}
------解决方案--------------------
var_write=document.write;
_write.call(document,"helloworld");