[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

toolbar/menubar



Hello all...   I have a page where I use java to pop up a window from a <a
href>: for example: .. <a href="edit.jsp?cn=<%=custName%>&sn=<%=suppNum%>"
target="_blank">Edit</a> ..   What I would like to know is there anyway of
specifying the size of the window opened and is there anyway of disabling some
attributes of the window object..for instance -- no menubars, toolbars,
scrollbars..etc...   all help is greatly appreciated! jags 

...

You have to change the href to a javascript function call, then code the
(client-side) javascript function to do a window.open where you can set all
those attributes:

<a href='Javascript:edit_record()'>

<!-- Note that in reality you want to put these JS funcs in HTML HEAD section
 -->
<SCRIPT language="Javascript"> 
function edit_record()
{
    // set url (GET method only works) then open popup window
    var url = "some-url?some-params&some-values";
    editrec_win = window.open(url, "win_editrec",     
      "screenX=10,screenY=10,height=500,width=740,"+
      "menubar=1,resizable=1,scrollbars=1,location='_top'");
    // screenX/Y - start coords for window, menubar etc, 1=ON 0=OFF

    // now put focus on new window (or refocus on reused window)
    if (window.focus && editrec_win) { editrec_win.window.focus(); }
}
</SCRIPT>

You could, of course, just put the window.open code directly in the href if you
wanted to, I just like to use functions because it's much neater.

You can also write the anchor tag like this:

<A href='Javascript:void(0)'                            
 onClick='edit_record(this.form)'            
 onMouseOver='self.status="Edit this record";return true'
 onMouseOut='self.status="";return true'>                 
[Edit Record]</A> 

hope that helps.

david hall.