Jump to content

ajaxextraordinaire

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ajaxextraordinaire's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All, believe i managed to solve this. Seems IE wont let me change <tr> with Javascript, I made it replace the entire table, and it works. Thanks
  2. Hi, Created my first AJAX script , and while it works fine in Firefox, it doesn't work at all in IE, not even a response. Put error messages in and it appears to fail on the part where it replaces the <tr> innerhtml right at the end. Curiously, it also fails the HTML earlier on , so some sort of problem with Getelementbyid? ==== <script type="text/javascript"> function refreshhandsets(type,point) { var point; var type; var oldhtml = document.getElementById("sl"); var minpoint = point-7; var newpointleft = Math.max(1,minpoint); var newpointright = Math.max(point,; alert(document.getElementById('sl').onclick) var newhtml = "refreshhandsets("+type+","+newpointleft+")"; var newhtmlright = "refreshhandsets("+type+","+newpointright+")"; alert ("about to set attributes"); document.getElementById("sl").setAttribute("onclick",newhtml); document.getElementById("sr").setAttribute("onclick",newhtmlright); alert ("now onto ifs"); if (type == 1) { document.getElementById("cont").setAttribute("class","selected"); document.getElementById("pg").setAttribute("class",""); } if (type == 2) { document.getElementById("pg").setAttribute("class","selected"); document.getElementById("cont").setAttribute("class",""); } alert ("about to get objects"); xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } alert ("done http object thing"); var url="ajaxhandsets.php"; url=url+"?type="+escape(type); url=url+"&point="+escape(point); alert ("created url"); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); alert ("end of onclick func"); } function stateChanged() { if (xmlhttp.readyState==4) { alert ("recieving response"); var element = document.getElementById("phonephotos"); alert(element.innerHTML); element.innerHTML = xmlhttp.responseText; alert ("and finally! updated HTML"); } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return null } </script> ==== HTML Snippets : <li id="cont" class="selected" onclick="refreshhandsets(1,1)"><a href="#"><span>contract</span></a></li> <li id ="pg" onclick="refreshhandsets(2,1)"><a href="#"><span>pay as you go</span></a></li> <a id="sl" class="slide left" href="#" onclick="refreshhandsets(1,1)"><span>slide left</span></a> <tr id="phonephotos"> ** Lots of images in td's** </tr> <a class="slide right" href="#" id="sr" onclick ="refreshhandsets(1,"><span>slide right</span></a> Any help much appreciated!
×
×
  • 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.