Проблем с дистанционно оправление на сайт

adrian

Registered
Значи правя един прозорец, който като се натисне на един линк да изкача и този прозорец да е нещо като дистанционно оправление на първия, но нещо ми дава грешка.

index.html
Код:
<html>
<head>
<title>Индекс</title>
<script>[color=red]<!-[/color]
	var remote = null;

	window.name = "content";

	function openRemote(contentURL, windowName, x, y) {
		widthHeight = 'height=' + y + ',width=' + x;
		if (remote) remote.focus();
		else var remote = window.open(contentURL, windowName, widthHeight);
	}
[color=red]//->[/color]
</script>
</head>
<body onload="openRemote('remote.html', 'remote',300,300)">
<a href="javascript:openRemote('remote.html','remote',300,300)">Open New Window</a>
</body>
</html>

remote.html
Код:
<html>
<head>
<title>Асистент</title>
<base target="content" />
<script>[color=red]<!-[/color]
	function closeWindow() {
		top.self.close();
	}
[color=red]//->[/color]
</script>
</head>
<body onload="window.moveTo(100,100)" onunload="if (opener) opener.remote = null;">
<div onclick="closeWindow()">Close</div>
</body>
</html>

Извинявам се за поста. Открих грешката трябва да е така:

index.html
Код:
<html>
<head>
<title>Индекс</title>
<script>
	var remote = null;

	window.name = "content";

	function openRemote(contentURL, windowName, x, y) {
		widthHeight = 'height=' + y + ',width=' + x;
		if (remote) remote.focus();
		else var remote = window.open(contentURL, windowName, widthHeight);
	}
</script>
</head>
<body onload="openRemote('remote.html', 'remote',300,300)">
<a href="javascript:openRemote('remote.html','remote',300,300)">Open New Window</a>
</body>
</html>

remote.html
Код:
<html>
<head>
<title>Асистент</title>
<base target="content" />
<script>
	function closeWindow() {
		top.self.close();
	}
</script>
</head>
<body onload="window.moveTo(100,100)" onunload="if (opener) opener.remote = null;">
<div onclick="closeWindow()">Close</div>
</body>
</html>
 

Back
Горе