View Full Version : how to set focus on image in popup.

10-26-2009, 05:23 AM
Hi Friends,

I am setting focus in popup window .in IE it is working properly but in mozilla the same code is not able to set focus on image.please tell me the solution if u knows.

My code is follows...myJsp.jsp==========

<div class="smallDottedBlueLink" >
<a title="" class="smallDottedBlueLinkAnchor" href="#" onkeypress="setFocusOnKeyPressPopUp(event);" onclick="setFocusOnClickPopUp();"
id="Hotels_TnC_popUp">View Terms and Conditions</a>
//focusNew1 is the id of the image in popup page.
function setFocusOnKeyPressPopUp(event){
// setTimeout('dummy();',3000);

function setFocusOnClickPopUp() {
} </div>

=============html page===============popup code ====
<div class="popup-top-corner-left-img"></div>
<div class="popup-top-image"></div>
<div class="popup-top-corner-right-img"></div>
<div class="popup-left-image"></div>
<div class="popup-div1">
<div class="XX-Large-Dark-Gold-popUpText">ffffff</div>
//id="focusNew1" for this id i need to set focus <div class="sprite-btn-close" id="focusNew1" onkeydown="javascript:return keyCheck(event)" onkeypress="javascript:closePopUpLayer1(event)" onclick="javascript:closePopUpLayer(),document.getElementById('Hotels_TnC_popUp').focus();" ></div> </div>
<div class="popup-dark-gray-text">fff</div>
<div class="popup-right-image"></div>
<div class="popup-bottom">
<div class="popup-bottom-corner-left-img"></div>
<div class="popup-bottom-image"></div>
<div class="popup-bottom-corner-right-img"></div>

please let me know in case any mistake i made ...its very urgent.
ThanksIn advance.

10-26-2009, 06:24 AM
try using self.focus() for the image.

let us know if that works.

10-26-2009, 07:00 AM
where i need to use this line