• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AJAX JSP Calendar

 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to HTML/Javascript.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onclick="return false;"

Eric
 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why use an anchor tag to begin with? Just put the onclick on the image.
 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic