Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pop-up new window using document.write

Status
Not open for further replies.

zwrley

Programmer
Aug 7, 2001
14
PH
I'm dynamically creating the contents of my html page, the page includes a link that would pop up a new window without the toolbar and stuffs. I've tried everything to call the pop up window but it kept showing me "Object Expected" error. Any help would be appreciated. Thanks

<script language=&quot;javascript&quot;>
function testLink()
{
document.open();
document.write('<body bgcolor=&quot;#FFFFFF&quot;>');
document.write('<table width=&quot;100%&quot; border=&quot;0&quot; align=&quot;center&quot;>');
document.write('<tr><td>');
document.write('<a href=&quot;javascript:NewWindow(\'deviationFrame.html\', \'deviationFrame\')&quot;>');
document.write('POPUP WINDOW</a></td></tr></table></body>');
document.close();
}

function NewWindow(myPage, myName)
{
w = 950
h = 620

var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl
+',scrollbars='+no+',resizable'
win = window.open(myPage, myName, winprops)
}
</script>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot; onLoad=&quot;testLink()&quot;>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;&quot;>
</form>
</body>
</html>
 
Hi
When you do a document.write statement it actually writes a new document with this information. Run your page and take a look at the source. You will see that your function isn't there anymore, because all existing info has been replaced by your document.write. That is why you have the error. You will have to document.write the function that you need to run to the page also (along with anything else you want to output).

Make sense?

Terry Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top