PDA

View Full Version : onload body issue. Need help



Coding Coder
02-24-2011, 02:06 PM
I am currently updating an online form and to do the follwoing:

This form is posted once a month via a link from the homepage but also from our forums. I want to know what code I need to add so that no matter how the form is accessed (Its a HTML form) when the new window opens it will resize and remove the toolbars, scrollbars and menu bars.

I want it to be done via onload. from what I have read this can be done and so far Ive managed to code it so that everytime the page loads it opens in a new window at 610x370 and the scrollbars dissapear but I cant for the life of me remove the toolbars and menu bars. I know this would be impossible if I was trying to load the form in the same parent window but I am trying to load it into a new window and I just cant get it to work.

Here is the code im using:

<script language="javascript">
function resizeWindow()
{
window.resizeTo(610,370)
}
</script>

<body onload="resizeWindow()" scroll=no>

Many Thanks to who ever can help me as I am really stuck.

Coding Coder
02-28-2011, 07:37 AM
can any one help me at at all please? 130 views and no one knows the answer?

Beverleyh
02-28-2011, 11:58 AM
This might suit your needs: http://www.dynamicdrive.com/dynamicindex8/autocenter.htm

Rather than worry about resizing a window after it opens, I think it would be easier to specify the size, etc. in the onclick event from the preceding page.

molendijk
02-28-2011, 10:34 PM
Couldn't you just use an iframe? Something like:

<script type="text/javascript">
function iframe_popup(){
var iframe_pop=document.createElement('iframe');
iframe_pop.setAttribute("scrolling", "no");
iframe_pop.setAttribute("frameBorder", "no");
iframe_pop.setAttribute("width", 610);
iframe_pop.setAttribute("height", 370);
iframe_pop.style.border="1px solid black";
iframe_pop.style.position="absolute";
iframe_pop.style.left="50%";
iframe_pop.style.top="50%";
iframe_pop.style.marginLeft="-305px";
iframe_pop.style.marginTop="-185px";
iframe_pop.setAttribute("src", "http://www.google.com");
document.body.appendChild(iframe_pop);
}
window.onload=iframe_popup;
</script>
But I don't know if that's what you want.
Note: the part in red is needed if you want to center the iframe.
===
Arie Molendijk.