Advance software forum
February 04, 2012, 02:12:40 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Advance Software Popup conflict  (Read 646 times)
0 Members and 1 Guest are viewing this topic.
smoky
Newbie
*
Offline Offline

Posts: 2


View Profile
« on: March 14, 2009, 07:02:29 PM »

Hello,
I really like the Advance Software Popup. Thank you for offering it. I think it is conflicting with some javascript I have for quick ajax search located here:

http://www.oscommerce.com/community/contributions,3413/page,7

The javascript for that contribution is:

Code:
var req;

function loadXMLDoc(key) {
 
   var url="quickfind.php?osCsid=<?php echo tep_session_id();?>&keywords="+key;

   // Internet Explorer
   try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
   catch(e) {
      try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch(oc) { req = null; }
   }

   // Mozailla/Safari
   if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); }

   // Call the processChange() function when the page has loaded
   if (req != null) {
      req.onreadystatechange = processChange;
      req.open("GET", url, true);
      req.send(null);
   }
}

function processChange() {
   // The page has loaded and the HTTP status code is 200 OK
   if (req.readyState == 4 && req.status == 200) {

      // Write the contents of this URL to the searchResult layer
      getObject("quicksearch").innerHTML = req.responseText;
   }
}

function getObject(name) {
   var ns4 = (document.layers) ? true : false;
   var w3c = (document.getElementById) ? true : false;
   var ie4 = (document.all) ? true : false;

   if (ns4) return eval('document.' + name);
   if (w3c) return document.getElementById(name);
   if (ie4) return eval('document.all.' + name);
   return false;
}


window.onload = function() {
   getObject("keywords").focus();
}

I think this may be interfering with window.onload in lightbox.js

Code:
function addLoadEvent(func)
{
var oldonload = window.onload;
if (typeof window.onload != 'function'){
    window.onload = func;
} else {
window.onload = function(){
oldonload();
func();
}
}

}

I get the following error in IE:
"Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."

Any tips on how to solve this issue would be greatly appreciated. I know you also offer the Ajax search code but I like this one better because it searches for all words in title and does not use auto suggest.

Thanks.

Smoky
« Last Edit: March 14, 2009, 07:04:11 PM by smoky » Logged
smoky
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #1 on: March 14, 2009, 08:20:50 PM »

I managed to make these two contributions work together in firefox and IE by this hack.

I added this code to the quick Ajax search javascript.

Code:
//disabling this makes everything work in IE
//window.onload = function() {
   //getObject("keywords").focus();
//}

//this code makes everything work in both browsers...not sure why 
if (navigator.userAgent.indexOf("Firefox")!=-1)
window.onload = function() {
   getObject("keywords").focus();
   initLightbox();
}

Can someone explain to me why it works?
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!