Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:26:49+00:00 2026-06-10T05:26:49+00:00

I currently have this Javascript in a file named getresults.js: function getItems(str) { if

  • 0

I currently have this Javascript in a file named getresults.js:

function getItems(str)
{
if (str=="")
  {
  document.getElementById("getItems").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("getItems").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","/include/retrieveitems.php?q="+str,true);
xmlhttp.send();
}

It’s called upon by this event:

onclick="getItems('all')"

It works perfectly in Firefox, IE, Chrome.. but Opera refuses to work. A very small percentage of my visitors are Opera users, but still.. I’d rather have it work. A live url can be found here: http://tf2g.com/gallery

If anyone can help, much obliged!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:26:50+00:00Added an answer on June 10, 2026 at 5:26 am

    The reason this fails is that the event handler is not calling your getItems() method at all. It sees the document.getItems() method from Opera’s Microdata support ( http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html ) and calls that instead. It’s a question of JavaScript scope: both the element itself and its document is in scope, so methods/properties defined here will be able to hide methods / properties you define in the global scope.

    Be happy that Opera implemented Microdata early so you noticed this 🙂

    The simplest fix is to rename your function to avoid name collision with Microdata. You can also use addEventListener() instead of writing onclick=”” in the markup – if you do the scope of the function is the scope it is created in, so you don’t run into such gotchas.

    window.addEventListener('load', function(){
      for( var i=0,l;l=document.links[i]; i++ )if( l.hash){
        l.addEventListener( 'click', function(){
          getItems(this.hash.substr(1));
        }, false);
      }
    }, false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have this: function submit() { document.getElementById(lostpasswordform).click(); // Simulates button click document.lostpasswordform.submit(); //
I currently have this code: PACKETS = {}; function AddPacket(data) local id = data.ID;
I have a file that looks like this: function UserController(){}; UserController.prototype = { theData:
I currently have an ASP.Net MVC 3 website that hosts a physical JavaScript file
I currently have this sql statement that I wrote and it works but it's
I currently have this and it works fine but I wanted to have a
I currently have this code which stores XML into an XML-type column called data,
I currently have this set up and working fine inside a users folder. RewriteEngine
I currently have this code : Private Sub Worksheet_Change(ByVal Target As Range) Dim lastrow
I currently have this code Private Sub Worksheet_Change(ByVal Target As Range) WorksheetChanged(Target, Range(AB3).CurrentRegion, Range(B18:B19))

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.