Click to See Complete Forum and Search --> : Change Window Attributes (URGENT)
amacfarl
10-20-2003, 03:40 PM
Folks,
I would like to do the following actions after a window is created:
- remove toolbar
- remove scrollbar
- resize
- reposition
Is there anywhere where I can get a comprehensive list of all the attributes of the windows elements.
Thanks in advance
Angus
fredmv
10-20-2003, 03:51 PM
- remove toolbarI don't believe this is possible. I think it can only be done once you create a new window using the open method.
- remove scrollbarThis is possible. The two following pieces of code will do this:document.body.style.overflow = "hidden";document.body.setAttribute( "scroll", "no" );
- resizeThis is also possible. You can do this using the resizeTo method. Here's a simple example that will resize the window to 500x500:window.resizeTo( 500, 500 );
- repositionThis is possible as well. This is done using the moveTo method. Here's a simple example that moves the window to the top left edge of the screen:window.moveTo( 0, 0 );
Is there anywhere where I can get a comprehensive list of all the attributes of the windows elements.There sure is. Check the Netscape DevEdge JavaScript 1.5 Core Reference (http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/). ;)
I hope that helps you out.
Alien Man
10-20-2003, 03:58 PM
When opening a new window you wold specify the parameters this may help .
option explanation
toolbar = yes | no add/remove browsers toolbar
location = yes | no add/remove browsers location field
directories = yes | no add/remove browsers directories field
status = yes | no add/remove browsers status field
menubar = yes | no add/remove browsers menubar
scrollbars = yes | no add/remove browsers scrollbars
resizeable = yes | no allow new window to be resizable
width = value window width in pixels
height = value window height in pixels
EX.
PageURL="http://www.mydomain.com/myfile.html";
WindowName="MyPopUpWindow";
settings=
"toolbar=yes,location=yes,directories=yes,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width=600,height=300";
MyNewWindow=
window.open(PageURL,WindowName,settings);
amacfarl
10-20-2003, 04:11 PM
THANKS FOR REPLYING
I would like to use FORM POST to a PopUp Window. I have the following requirements:
1. And I would like to post using <a href> instead of a submit button.
2. The popup window has to be a specific size and no toolbar, not resizeale etc..
Below is my code. How come it works with the submit button, but not using <a href>
Thanks in advance. THIS IS SUPER URGENT...
Angus
<HTML>
<HEAD>
<SCRIPT language="javascript">
function formSubmit()
{
document.myform.submit();
}
function openMyPopup(url,target,W,H)
{
if (!W) W=200;
if (!H) H=200;
if (!target) target="_new";
var X = (screen.width/2)-(W/2);
var Y = (screen.height/2)-(H/2);
var winPref = "width=" + W + ",height=" + H
+ ",innerWidth=" + W + ",innerHeight=" + H
+ ",left=" + X + ",top=" + Y
+ ",screenX=" + X + ",screenY=" + Y
+ ",dependent=yes,titlebar=no,scrollbars=no,resizable=no";
openMyPopup.popup = window.open( url, target, winPref );
openMyPopup.popup.resizeTo(1*W,1*H);
openMyPopup.popup.focus();
return true;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="myform" ACTION="test3.htm" method="post" target="myPopUp"
onSubmit='return openMyPopup("",this.target,200,200);setTimeout("",250);' >
<INPUT type="submit">
</FORM>
<a href="javascript:formSubmit()">TESTING</a>
</BODY>
</HTML>
fredmv
10-20-2003, 04:38 PM
I believe it isn't working because the onsubmit event handler of the <form> element will only be fired by a genuine submit button; doing it through JavaScript will not fire the onsubmit event handler. You should really just use a real submit button since it will work correctly, and 13% (http://www.thecounter.com/stats/2003/May/javas.php) of users don't have JavaScript available to them.
amacfarl
10-20-2003, 04:46 PM
The issue is that we are developing a report. When the user clicks on any elements on the report we would like to display a popup box with more details of the record they clicked.
For example. If the user clicked on CustomerA, then all the sales of the customers would appear in the popup window.
Hence we would like to keep the details as links or it would be a page of submit buttons.
We are happy to use Javascript and force our users to do so if they are wanting to use our service.
However saying this...is there any way round this issue.
In the above code, BOTH options (<a href> and Submit button) work, however the <a href> option does not apply the window settings, i.e. size, toolbar etc...
One option would be to include this in the target window... but I have been told that removing the toolbar is not possible.
PLEASE PLEASE help.... we need to deliver our product shortly.