This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes AJAX JSP Calendar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX JSP Calendar" Watch "AJAX JSP Calendar" New topic
Author

AJAX JSP Calendar

graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Hi All,

I've written a basic calendar using AJAX and implemented it into a jsp.

I've made it so an img button displays the calendar and allows the user to select whatever date they want.

The problem is that when the user selects the button

the page returns focus to the top. Obviously this would be a huge pain in the ars if the date is at the bottom of the page. What can I do so the focus remains on the element?

TIA,

Graham


write, revise, re-write, revise, again...<br />write, revise, re-write, revise, again...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

Moved to HTML/Javascript.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
onclick="return false;"

Eric
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Hi Eric,

Thanks for the reply, but, by adding the following to my code:

makes nothing happen...

I think my problem is with the href=# as it shoots me to the top...

Isn't there a way to place a reference into the HTML and retain the focus there?

Thanks again!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

Why use an anchor tag to begin with? Just put the onclick on the image.
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Ok, sounds good, but, I have more than one call to different javascript functions and each different nav link does a specific task...

graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Well, since there could be multiple cal objects on one page I just went ahead and followed what I had done earlier. It seems to work.

Here's the tag that fixes it. I always seem to forget it. Anyways, thanks for the suggestions.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AJAX JSP Calendar
 
Similar Threads
AJAX Best Practices
AJAX JSP TagLib Interaction?
To include o/p from 1 HTML page into another
Jack Up Browser Viewport
Query regarding timezone