老孟!来拿分!给你的!
我按你的说法写了一对父子窗口,为什么子窗口不能调用父窗口的自定义对象的方法?
parent.html
//////////<html>
<head>
<title>PARENT AND CHILD WINDOWS</title>
<script language='JavaScript'>
var newwin=new newwin();
function newwin(alertmess){
this.alertmess=alertmess;
}
function alertmess(){
window.alert('success!');
}
</script>
</head>
<body BGCOLOR="#c0c0c0">
<a href="child.html" target="newindow">Create a child window</a><br>
<input type='submit' onclick=alertmess()>
</body>
</html>
child.html
//////////
<html>
<head>
<script language='javascript'>
function getParent(){
window.opener.newwin.alertmess();
}
</script>
<title>PARENT AND CHILD WINDOWS</title>
</head>
<body>
<input type='submit' value='get parent message' onclick=getParent()>
</body>
</html>
请你一定帮我!