Jump to content

Please help me get this code IE compatible


garethhall

Recommended Posts

Hello I have this php and ajax working together to update a DB. Now the code works if in safari firefox but doesn't seem to work IE  Any ideas way?

 

PHP

<?php do {$i++; ?>
        <tr class="tableBG1" <? echo ($i % 2? 'bgcolor="#262626"' : 'bgcolor="#2E2E2E"'); ?> >
        <form name="formId<?php echo $row_rs_ListPages['pageId']; ?>" method="post" action="">
          <td class="leftRow">
            <span >
          <input name="pageId" type="hidden" id="pageId" value="<?php echo $row_rs_ListPages['pageId']; ?>" />
          <?php echo $row_rs_ListPages['pageMetaTitle']; ?></span></td>
          <td class="leftRow"><?php echo $row_rs_ListPages['pageMetaDescription']; ?></td>
          <td  class="leftRow"><?php echo $row_rs_ListPages['pageDate']; ?></td>
          
          <td class="leftRow" align="center" valign="middle"><a href="cmsEditPage.php?pageId=<?php echo $row_rs_ListPages['pageId']; ?>"><img src="cmsImages/btnEdit.png" width="56" height="16" alt="Edit" /></a>   <a href="<?php echo $row_rs_ListPages['pagePath']; ?>" target="_blank"><img src="cmsImages/btnView.png" width="56" height="16" alt="Delete" /></a>
             
            <input <?php if ($row_rs_ListPages['pageStatus'] == "on") {echo "checked ='checked'";} ?> type="radio" name="status"  onchange="updatePageStatus(pageId.value, status.value='on')" />
            On
            <input <?php if ($row_rs_ListPages['pageStatus'] == "off") {echo "checked ='checked'";} ?> type="radio" name="status"  onchange="updatePageStatus(pageId.value, status.value='off')" />
           Off<br />
           </td>
          <td class="rightRowDouble"><div id="<? echo $row_rs_ListPages['pageId'] ?>"> </div></td>
        </form>
        </tr>
        <?php } while ($row_rs_ListPages = mysql_fetch_assoc($rs_ListPages)); ?>

 

And here is the Ajax

var xmlHttp
var id;
function updatePageStatus(pageId, status){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==null){
	alert("Browser does not support HTTP Request");
	return;
}; 
var url="cmsLiveUpdatePageStatus.php";
url += "?pageId="+pageId;
url += "&pageStatus="+status;
id = pageId;
alert(url);
xmlHttp.onreadystatechange=stateChanged ;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
};

function stateChanged(){ 
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	document.getElementById(id).innerHTML=xmlHttp.responseText;
};
};
function GetXmlHttpObject(){
var xmlHttp=null;
try{
	// Firefox, Opera 8.0+, Safari
	xmlHttp=new XMLHttpRequest();
}catch (e){
	// Internet Explorer
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	};
};
return xmlHttp;
};

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.