Forum Moderators: open
I'm trying to use this into a window I want to open resized, with no toolbar etc... but I can't make it work:
<script type="text/javascript">
function initPage() {
newwindow=open(sURL,"newwin","scrollbars=no, toolbar=no,
directories=no, menu bar=no, resizable=no,
status=yes, width=600, height=500");
}
</script>
<body onload="initPage()">
the following it works, but I need to make it with no toolbar etc...
<script type="text/javascript">
function initPage() {
window.moveTo(0, 0);
window.resizeTo(500, 400);
}
</script>
<body onload="initPage()">
Please, what I'm doing wrong?
Thanks!
tito
But if you were to view the Error Console in FireFox, you would see one of the errors is "sURL is not defined."
In this scenario, you would need to pass a value to the function.
<a href="#" onClick="return initPage('mypage.html');">New window here</a>
<script type="text/javascript">
function initPage(sURL) {
var day = newDate();
var id=day.getTime();
if (! sURL) { alert('you need to pass a URL value.'); }
else { newwindow=open(sURL,id,'width=600, height=500'); }
return false;
}
</script>
Note I just left out the attributes you don't want. No reason to specify "no."