Jump to content

Document.write


Twango

Recommended Posts

Man... i've tried this a THOUSAND times... yet it NEVER works... here ya go

<html><head><script type="text/javascript">new=window.open("","width=100 height=100)new.document.write("<input type='button' onclick='somefunction()'/>");</script></head></html>

can ANYONE help me... even if this is a dumb question...

Link to comment
Share on other sites

Edit: Actually, "new" is a reserved word, use another variable name.-------If you're not specific about the problem then we can't help you. "Not working" isn't specific enough, we need to know which part is not working.The first question is: Is the window is opening?If it is opening, does the button appear in the window?If the button does appear, is the function that the button calls not working?

Link to comment
Share on other sites

Make sure your browser allows pop-up windows. Those settings can be changed. You also want to check the syntax:window.open("","width=100 height=100)Your quotation marks don't work. And your list of attributes must be comma-separated.

Link to comment
Share on other sites

As for somefunction() -- where is the function located? As far as I can see, the only thing your new document contains is a button. If there is no script, there is no function, right?Or is this another one of those things where you haven't mentioned something important? Like maybe somefunction() is in the original document? Or does your window.open() method actually load a document, and somefunction() is in that? Either way, you have a problem. But I'm not going to solve it if I don't know which problem it is.

Link to comment
Share on other sites

  • 2 weeks later...

Probably. Most people who write responses check all the forums anyway, so it doesn't matter much.We're more likely to get miffed when someone resurrects a dead thread (unless it's their own). :)

Link to comment
Share on other sites

Man... i've tried this a THOUSAND times... yet it NEVER works... here ya go
<html><head><script type="text/javascript">function somefunction(){window.open("","width=100 height=100");}document.write("<input type='button' onclick='somefunction()' value='Open new window'/>");</script></head></html>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...