You (got a name? Struts Lover is so impersonal) can
invoke it by clicking on something in a page using
by adding onClick="SetScrollTo('someIDName');". If
you do that in an href, be sure to return false or
the page might submit. :)  You can do it anywhere 
onClick is supported.

If you use dynamic content (so anchors will not work
without forcing a re-submit), and want the client's
page to focus on a particular section, add javaScript
to your body's onLoad attribute such as:
SetScrollTo("someIDName");

OR just add this at the very end of your page so you
are 100% positive the rest of the page loade first:

<script language="JavaScript">
SetScrollTo("someIDName");
</script>

Now, go try it! :)

Regards,
David

-----Original Message-----
From: struts lover [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 24, 2004 12:49 PM
To: Struts Users Mailing List
Subject: RE: smart navigation


How and from where do I call the javascript function?
Thanks.

--- "David G. Friedman" <[EMAIL PROTECTED]> wrote:

> If you give an HTML tag the ID="..." attribute, you
> can give that ID to the SetScrollTo function.  That
> will set the focus and automatically move the 
> tag into the visible portion of the browser window.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: struts lover [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 24, 2004 12:29 PM
> To: Struts Users Mailing List; Dakota Jack
> Subject: Re: smart navigation
> 
> 
> Thanks Jack,
> 
> I am not very good at javascript.
> Can you please again explain how to use it.
> 
> Thanks once again.
> 
> --- Dakota Jack <[EMAIL PROTECTED]> wrote:
> 
> > Also, if you want similar things with other
> > browsers, here is a Mozilla deal:
> > 
> >  <script language="javascript">
> > function SetScrollTo(strControlID)
> > {
> > var
> > objControl=document.getElementById(strControlID);
> > document.body.scrollTop = objControl.offsetTop;
> > //maybe object is not focusable, hidden or
> disabled.
> > try
> > {
> > objControl.focus();
> > }
> > catch(e) {}
> > }
> > 
> > //usage:
> > SetScrollTo("CONTROL_ID"); //the string is the id
> of
> > the desired
> > control in the html document.
> > </script>
> > 
> > Jack
> > 
> > 
> > On Wed, 24 Nov 2004 05:39:09 -0800 (PST), struts
> > lover
> > <[EMAIL PROTECTED]> wrote:
> > > Hello Everyone,
> > > I wanted to know if smart navigation is possible
> > in
> > > JSP with Struts as it is with ASP.Net.
> > > If yes, I would like to know it. Any help would
> be
> > > appreciated.
> > > Thanks everyone.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to