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

  • Home
  • SEARCH
  • 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 832235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:19:52+00:00 2026-05-15T04:19:52+00:00

1) This issue involves just one html webpage, lets call it ajax.html. 2) I

  • 0

1) This issue involves just one html webpage, lets call it “ajax.html”.

2) I have AJAX functions in this webpage that work in both Firefox and IE8.

3) I now attempt generating just the option values of a dropdown list of dates using my ajax functions, and it works in Firefox & Opera, but not IE8.

4) The surrounding html code for the dropdown looks like this:

<select name="entry_7_single" id="entry_7" onChange="Ajax_PhpResultsWithVar('./secure/db/SummaryCls.php','entry_8','dateval',this.value)"></select>

The onchange call refers to an ajax function that successfully (both Firefox & IE8) populates a textarea (entry_8) with a description of an event associated with the date selected in this dropdown.

5) An onload call initiates the ajax function to generate the dropdown list values:

<body class="ss-base-body" onLoad="OnLoadWebPage()">

6) The js script that calls the ajax function is as follows:

function OnLoadWebPage()
{
    Ajax_PhpResults('./secure/db/GenDateListCls.php','entry_7');
}

7) Since it works in Firefox, but not IE8, I throw the output of the ajax function into a Firefox large textbox and I get the following:

<option selected value="8 JUN 2010">8 JUN 2010</option>
<option value="9 JUN 2010">9 JUN 2010</option>
<option value="10 JUN 2010">10 JUN 2010</option>
<option value="11 JUN 2010">11 JUN 2010</option>

8 ) There are over a hundred generated but you get the gist of what the ajax function generates. Next I will list the PHP function that outputs the above dropdown values:

<?php
include_once 'SPSQLite.class.php';
include_once 'misc_funcs.php';

class GenDateListCls
{
    var $dbName;
    var $sqlite;

    function GenDateListCls()
    {
        $this->dbName = 'accrsc.db';
        $this->ConstructEventDates();
    }

    function ConstructEventDates()
    {
        $this->sqlite = new SPSQLite($this->dbName);
        $todayarr = getdate();
        $today = $todayarr[mday] . " " . substr($todayarr[month],0,3) . " " . $todayarr[year];
        $ICalDate = ChangeToICalDate($today);
        $dateQuery = "SELECT dtstart from events where substr(dtstart,1,8) >= '" . $ICalDate . "';";
        $this->sqlite->query($dateQuery);
        $datesResult = $this->sqlite->returnRows();

        foreach (array_reverse($datesResult) as $indx => $row)
        {
            $normDate = NormalizeICalDate(substr($row[dtstart],0,8));
            if ($indx==0)
            { 
?>
<option selected value=<?php echo('"' . $normDate . '"'); ?>><?php echo $normDate; ?></option>
<?php
            }
            else
            {
?>
<option value=<?php echo('"' . $normDate . '"'); ?>><?php echo $normDate; ?></option>
<?php
            }
        }
        $this->sqlite->close();
    }
}
$dateList = new GenDateListCls();
?>

9 ) Here are the ajax functions, I created and used (of course, some portions are modified from examples off the web):


function Ajax_XMLHttpRequest_Factory()
{   
   var ajxRequest;

   try
   {
      // Opera 8.0+, Firefox, Safari
      ajxRequest = new XMLHttpRequest();
   } 
   catch (e)
   {
      // Internet Explorer Browsers
      try
      {
         ajxRequest = new ActiveXObject("Msxml2.XMLHTTP");
      } 
      catch (e) 
      {
         try
         {
            ajxRequest = new ActiveXObject("Microsoft.XMLHTTP");
         } 
         catch (e)
         {
            // Something went wrong
            alert("Unable to create an XMLHttpRequest with this current browser.");
            return false;
         }
      }
   }

   return ajxRequest;
}

function Ajax_PhpResults(fname,elementID){

    var ajaxRequest = Ajax_XMLHttpRequest_Factory();

    // Create a callback function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function() {
    if(ajaxRequest.readyState == 4){
        var ajaxDisplay = document.getElementById(elementID);
        ajaxDisplay.innerHTML = ajaxRequest.responseText;
    }
    }

    ajaxRequest.open("GET", fname, true);
    ajaxRequest.send(); 
}

function Ajax_PhpResultsWithVar(fname,elementID,varpassed,value){

    var ajaxRequest = Ajax_XMLHttpRequest_Factory();

    // Create a callback function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function() {
    if(ajaxRequest.readyState == 4){
        var ajaxDisplay = document.getElementById(elementID);
        ajaxDisplay.innerHTML = ajaxRequest.responseText;
    }
    }

    ajaxRequest.open("GET", fname+"?"+varpassed+"="+value, true);
    ajaxRequest.send(); 
}

function Ajax_RunPhpOnly(fname){

    var ajaxRequest = Ajax_XMLHttpRequest_Factory();
    ajaxRequest.open("GET", fname, true);
    ajaxRequest.send(null); 
}

I appreciate any assistance on this matter.

My Background:
To let you all know, I am a complete newbie to PHP, Ajax, & javascript, and learning it all on my own, no classes. My background is in Linux, Windows, C++, Java, VB,VBA,MS XML, & some html.

  • 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-05-15T04:19:52+00:00Added an answer on May 15, 2026 at 4:19 am

    Try not using innerHTML. IE historically does not allow you to innerHTML everywhere you would think possible. Instead try slower, clunkier DOM methods .appendChild().
    For example, have the PHP return JSON or XML with the value/text pairs you need, then when you AJAX it do something like this:

    PHP output (aka your http.responseText):

    {value:"20100608",text:"date 1"},
    {value:"20100609",text:"date 2"},
    {value:"20100610",text:"date 3"},
    {value:"20100611",text:"date 4"},
    {value:"20100612",text:"date 5"}
    

    JavaScript:

    http.onreadystatechange = function(){
        if(http.readyState == 4){
            eval("var data = [" + http.responseText + "]");
            for(var i=0;i<data.length;i++)
                var t = document.createElement("option");
                t.value = data[i].value;
                t.innerHTML = data[i].text;
                document.getElementById("entry_7").appendChild(t);
            }
        }
    }
    

    I am not sure why you are experiencing the problem you are, but I am guessing it has to do with the innerHTML of a select element in IE. Try my above method and I’m pretty sure it’ll work.

    I hope this helps in some way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: This issue appears to be limited to SQL Server 2005 SP2 I have
I desperately need some help on this one. I've created a <script> that closely
One issue that comes up during Pinax development is dealing with development versions of
I have two tables that get joined regularly. Table One is about 1 Million
I'm building some application, the involves training programs. my issue is like this, A
I have having a very odd issue when utilizing this UIAlertView. When viewing a
This issue has been on/off bugging me and I've written 4 wrappers now. I'm
This issue is better demonstrated than explained, so I've set up a git repo
This issue has me baffled, it's affecting a single user (to my knowledge) and
This issue is somewhat related: Problem with Code Generated by XSD.EXE: Sequence of Elements

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.