Forum : javascript
Brief description  about Online courses   join in Online courses
View neeraj  khatri 's Profile

javascript

Respected sir..
my code is
<html>
<head>
<title>writing to subwindow</title>
<script language="javascript">
var newWindow

function makeNewWindow(){
newWindow=window.open("","","HEIGHT=300,WIDTH=300")
}
function subWrite(){
if (newWindow.closed){
makeNewWindow()
}
newWindow.focus()
var newCOntent="<html><head><title>A New Doc</title></head>"
newContent ="<body>Brand New"
newContent ="</body></html>"
newWindow.document.write(newContent)
newWindow.document.close()
}
</script>
</head>
<body onLoad="makeNewWindow()">
<form>
<input type="button" value="write to sub window" onClick="subWrite()">
</form>
</body>
</html>


it is showing the new window but when i click on the button it do not write the text in new window.
Asked by neeraj khatri | Aug 20, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi Neeraj,

use the below code to create a new window and display the text.

w = open("","","width=200,height=100");
w.document.open();
w.document.write("<html><title></title><head></head><body>"+c+"</body></html>"); // to show some result of the operation.
//w.document.write("<html><title></title><head></head><body>Hello World...!!</body></html>"); // to show static content.

w.document.close();
Aug 23, 2010