你加一个document就不会报错了: function sendvalue(mH,mM){ var mObj=window.dialogArguments; var m=mObj.document.getElementsByName("SENDTEXT"); alert(m[0].value); window.close(); }
window.showModalDialog 你了解这个里面的参数吗?
还有接受的时候你都了解 function sendvalue(mH,mM){ var mObj=window.dialogArguments; var m=mObj.getElementsByName("SENDTEXT"); alert(m[0].value); window.close(); } 你直接这么用肯定是出错的 一般都是这样document.getElementsByName("SENDTEXT"); 如果是承接上级的动作,那么前面的Obj应该放在下面,也就是Obj.document.getElementsByName("SENDTEXT");
function sendvalue(mH,mM){
var mObj=window.dialogArguments;
var m=mObj.document.getElementsByName("SENDTEXT");
alert(m[0].value);
window.close();
}
你了解这个里面的参数吗?
function sendvalue(mH,mM){
var mObj=window.dialogArguments;
var m=mObj.getElementsByName("SENDTEXT");
alert(m[0].value);
window.close();
} 你直接这么用肯定是出错的
一般都是这样document.getElementsByName("SENDTEXT");
如果是承接上级的动作,那么前面的Obj应该放在下面,也就是Obj.document.getElementsByName("SENDTEXT");
function show(){
alert("self.test.value="+self.test.value);
alert("window.test.value="+window.test.value);
alert("document.form1.test2.value="+document.form1.test2.value);
alert("test.value="+test.value);
alert("document.all.test.value="+document.all.test.value);
alert("document.test.value="+document.test.value); //这一句出错
}
</script>
<input name="test" type="text"/><input type="button" value="click me" onclick="show()"><form name="form1">
<input name="test2" type="text"/>
</form>
上面几种调用方法,实在是有些不理解,为何document.test.value调用会出错呢?
self,window,document,form,document.all与页面中各元素之间的是什么关系?具体该如何调用呢?
即然元素存在页面中,为何document.test.value又错误呢?
还请指点,谢谢!
楼主,这你也用得出来,你得基础学哪去了啊???
晕死了!虽然你的精神很可嘉。但是藐视基础。
document.getElementsByName("test").value
这个才是对的!
介绍一本书你看看。
DOM推荐取值: document.getElementById(); document.getElementsByTagName();document.getElementsByName()
window窗体与元素(text,button...),document与元素之间各是什么关系呢?是不是单个元素如text,button,checkbox是window的子元素,而不是document的子元素?
而form,img也是document子元素?也就是可以document.form...来调用?还请各位大侠指点,谢谢!
介绍一本书你看看。