• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set focus on a button in mozilla  RSS feed

 
Sahil Saxena
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have written a confirmation page in Struts which contains 1 label field "Username" and 2 buttons "Yes" & "No" respectively.

In IE when user navigates to the confirmation page I set the focus to the "Yes" button using following javascript code:


The above code works in IE

In Mozilla I tried to set focus on the button using the following code:

The above code does not work.

My observations:

For Mozilla browser:If I add any text field in the above confirmation page and set focus to it then whenever the user press enter key the "Yes" button is clicked. The code is as follows:
Javascript code:


Struts code (Addition of extra text field)


Problem:
I am not able to set focus on "Yes" button using javascript for Mozilla browser.I want that whenever user navigates to confirmation page and press enter key then "Yes" button should be selected.

Note: There is only a label field on my confirmation page and no text field

I have posted this question in this forum because I am using javascript to set focus on the buttons

Complete Code:


Please help me. I am struggling from last 2 days.

Thanks and regards.
 
Anubhav Anand
Ranch Hand
Posts: 341
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't repost across different forums. It wastes time and efforts.

This eminently is a Javascript question and you rightly posted it on this thread in HTML and JavaScript forum.

I really don't see a point in reposting it again in this Strut's forum.

Now, show some dignity and request a moderator to close this thread.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!