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!

resizing window ( new window) in var newPage

Status
Not open for further replies.

buckDharma

Programmer
Jul 30, 2009
3
US
Hello

I am trying to resize a new window in the javascript and not assign the href the new window size - heres what I mean:
Code:
function createNewWindow () {
var userName = document.getElementById('user_name').value
var newPage = "<html><head><title>"
newPage += userName;
newPage += "</title></head><body>";
newPage += "<p>Here is the info you typed in: " + userName;
newPage += "</p></body></html>";
var j = window.open('')
j.document.write(newPage);
j.document.close();
}
so what I mean is - can I put the size of the new window in the "NewPage +=" ? I am not sure how that would look - maybe even have it in a new position on the page?

Thanks
Rob
 
I think I partially have the answer:
Code:
var j = window.open('')
j.document.write(newPage);
j.resizeTo(400,300)
j.moveTo(150,300)
j.document.close();
but in FF.. unless I allow script to not ( uncheck) resize window it doesnt work too well.. in IE its fine
 
Hi

Why not just setting the [tt]window.open()[/tt]'s 3[sup]rd[/sup] parameter ?
Code:
[b]var[/b] j [teal]=[/teal] window[teal].[/teal][COLOR=darkgoldenrod]open[/color][teal]([/teal][green][i]''[/i][/green][teal],[/teal][green][i]''[/i][/green][teal],[/teal][green][i]'width=400,height=300,left=150,top=300'[/i][/green][teal])[/teal]
By the way, [tt]window.open()[/tt]'s 2[sup]nd[/sup] parameter is also mandatory.

[tt][small][red][ignore][flame][/ignore][/red][/small][/tt]
This is one of my reasons for using FireFox : it does what I want, not what an unknown webmaster wants. And I not want to have my windows resized.
[tt][small][red][ignore][/flame][/ignore][/red][/small][/tt]


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top