本范例演示了JS如何通过window.open函数打开一个新窗口,及其参数设置
function open_window(url){ var wparams = 'toolbar=0,location=0,directories=0,status=0,menubar=0,'; wparams += 'scrollbars=0,resizable=0,width=280,height=150'; var window = window.open(url, 'window_name', wparams); window.focus(); } function create_window(content){ var wparams = 'toolbar=0,location=0,directories=0,status=0,menubar=0,'; wparams += 'scrollbars=0,resizable=0,width=280,height=150'; var window = window.open('', 'window_name', wparams); window.document.open(); with(window.document){ write(content); write("<br/>"); write("<a href=\"javascript:self.close();\">Close window</a>"); } window.document.close(); window.focus(); }