Jump to content

error


10 weber

Recommended Posts

I used the following code. The window opens, and the button exists, but clicking it doesn't work.

function winOpen(stAction, stName) {    var win = window.open("", "", "width=200, height=200");    win.document.write("<button onclick='java script:win." + stAction + ";'>" + stName + "</button>"); //I tried with and without "win." at the onclick event.}...<button onclick="winOpen('close()', 'close')">open and close</button>

(I didn't forget the script, html, body,... tags)

Link to comment
Share on other sites

win is a variable visible only to the document that opened the new window. The new window you opened doesn't have access to it. You can just use window.close() and that will close the window from which close() was called.win.document.write("<button onclick='java script:window." + stAction + ";'>" + stName + "</button>");this.close() should also work. Scratch that. That won't work. In this situation this would be referring to the button, not the window.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...