Hi. I don't know where the problem is. The next codes is working on Google Chome but not in IE. I haven't tested yet on Firefox.
function getSheetCount() {
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
var txt = xmlhttp.responseText;
for(i=0; i<parseInt(txt); i++){
document.getElementById('sheetNo').innerHTML+="<option value=\""+ i +"\">"+(i+1)+"</option>";
}
}
}
xmlhttp.open("GET","excelreader.php",true);
xmlhttp.send();
}
excelreader.php
<?php
error_reporting(E_ALL);
require_once 'Classes/PHPExcel.php';
$inputFileName = 'rf1.xls';
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
echo $objPHPExcel->getSheetCount();
?>
index
<label>Sheet no:</label><select name="sheetNo" id="sheetNo"></select>
I tried prompting a dialog box on getSheetCount and it shows this error
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C)
Timestamp: Mon, 23 May 2011 09:52:49 UTC
Message: 'document.getElementById(...)' is null or not an object
Line: 152
Char: 5
Code: 0
URI: http://localhost/final/javascript/functions.js
By the way, I am using Internet Explorer 8.
Please help me,
Michael