Sorry for the typing mistakes, I was in a hurry. You can get the current available
window size with:

function setSpacer() {
    var winHeight = screen.availHeight;
    var winWidth  = screen.availWidth;

    if (winWidth() > 800) {
      document.write("<img src=images/0.gif width=120>");
     } else {
      document.write("<img src=images/0.gif width=40>");
     }:
}

Call this function from the page area where you would normally hardcode the image.
Any other help you can email me directly since this isn't referring to jsp any
longer.

Brian
[EMAIL PROTECTED]

Brian P Bohnet wrote:

> Dude,
>     it will be in the javascript included in every page. I don't know where you
> are going with the logged in thing. When you say pure JSP it isn't possible
> because the JSP code is on the server-side.
> In the javascript you can dynamically set the by using document.write() to produce
> the html the browser will interpret.
> I suggest looking it up dhtml examples with Google.
>
> Christopher Doyle wrote:
>
> > I need this to work for every user, not just logged in users. Anyone know of
> > a way to do this in pure JSP?
> >
> > Chris
> >
> > ----- Original Message -----
> > From: "Steven A. Martin" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, September 09, 2002 12:48 PM
> > Subject: Re: Getting screen height and width
> >
> > > DisplayMode is part of the java.awt package, not the servlet/JSP packages.
> > > You can find out the screen size through JavaScript.  I don't believe the
> > > browser sends the dimensions of itself to the server which is the only way
> > > you could do something like this.
> > >
> > > What you could do is in the user's login screen for the session, have
> > > JavaScript discover the monitor sizing, then submit to the server to save
> > > for any additional screens.  You can also use JavaScript to output HTML.
> > I
> > > use this rarely due to the difficulty in maintaining multiple HTML
> > renderers
> > > (JS and JSP then.)
> > >
> > > Steven
> > >
> > >
> > > ----- Original Message -----
> > > From: "Christopher Doyle" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Monday, September 09, 2002 12:13 PM
> > > Subject: Getting screen height and width
> > >
> > >
> > > > I'm interested in using JSP to get the screen dimensions (not the window
> > > > dimensions) in order to size a graphic on my page. If the screen size is
> > > > greater than 800x600, I want the graphic to be larger. Here's the script
> > I
> > > > was trying to use, but I keep getting errors that I can't make static
> > > > reference to method blah... I tried using the DisplayMode.getWidth()
> > > method,
> > > > but that requires me to create an object of type DisplayMode from which
> > I
> > > > can then get its width. But I'm interested in getting the width of the
> > > > current user's screen, not one I might create in my program. I've also
> > > tried
> > > > the Window.getWidth() with similar results.
> > > >
> > > > Can I do this in JSP?
> > > >
> > > > code:
> > > >
> > > >  String spacer = null;
> > > >  DisplayMode displayMode = new DisplayMode(800,600,24,72); //I don't
> > want
> > > to
> > > > create this
> > > >
> > > >  if (displayMode.getWidth() > 800) {
> > > >  spacer = ("<img src=images/0.gif width=120>");
> > > >  } else {
> > > >  spacer = ("<img src=images/0.gif width=40>");
> > > >  }
> > > >
> > > > Thanks for any help,
> > > >
> > > > Chris
> > > >
> > > >
> > >
> > ===========================================================================
> > > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > JSP-INTEREST".
> > > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > > DIGEST".
> > > > Some relevant FAQs on JSP/Servlets can be found at:
> > > >
> > > >  http://archives.java.sun.com/jsp-interest.html
> > > >  http://java.sun.com/products/jsp/faq.html
> > > >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > > >  http://www.jguru.com/faq/index.jsp
> > > >  http://www.jspinsider.com
> > > >
> > >
> > >
> > ===========================================================================
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > >  http://archives.java.sun.com/jsp-interest.html
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > >  http://www.jguru.com/faq/index.jsp
> > >  http://www.jspinsider.com
> > >
> >
> > ===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to