Jump to content


  • Posts

  • Joined

  • Last visited

settergren's Achievements


Newbie (1/7)



  1. What happens now is that I can get IE to read the form properly by setting the charcode to iso-8859-1 in the php-include. But then it i misinterpreted in FF instead where funny characters start to appear and it also reads the xml-file wrongly. Help! When I set everything to UTF-8 it works in Firefox but with iso-8859-1 it doesn't work there...
  2. Thank you for your answer. Did you have the same problem with your live search working everywhere but in IE? I tried your solution and it doesn't change anything for me. I've tried to change to encoding iso-8859-1 (recommended for swedish) and to utf-8 and to windows-1255 and i've done the changes to both the php-pages and the xml-page.Still running smoothly in FF and with letters a-z in IE. The problem seems to be in the form-function. All the å,ä and ö-letters show up perfectly in the results even in IE and you can write them in the form. But when I check how IE interprets what was written in the form it replaces å,ä and ö with squares or nothing... Extremely frustrating
  3. I get the feeling that it can make a change if I use $_POST instead of $_GET but I'm not sure how to adapt the code from the example. Anyone out there that could give me a hand? Any other suggestions? <html><head><script type="text/javascript">function showResult(str){if (str.length==0) { document.getElementById("livesearch").innerHTML=""; document.getElementById("livesearch").style.border="0px"; 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("livesearch").innerHTML=xmlhttp.responseText; document.getElementById("livesearch").style.border="1px solid #A5ACB2"; } }xmlhttp.open("GET","livesearch.php?q="+str,true);xmlhttp.send();}</script></head><body><form><input type="text" size="30" onkeyup="showResult(this.value)" /><div id="livesearch"></div></form></body></html><?php$xmlDoc=new DOMDocument();$xmlDoc->load("links.xml");$x=$xmlDoc->getElementsByTagName('link');//get the q parameter from URL$q=$_GET["q"];//lookup all links from the xml file if length of q>0if (strlen($q)>0){$hint="";for($i=0; $i<($x->length); $i++) { $y=$x->item($i)->getElementsByTagName('title'); $z=$x->item($i)->getElementsByTagName('url'); if ($y->item(0)->nodeType==1) { //find a link matching the search text if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q)) { if ($hint=="") { $hint="<a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } else { $hint=$hint . "<br /><a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } } } }}// Set output to "no suggestion" if no hint were found// or to the correct valuesif ($hint=="") { $response="no suggestion"; }else { $response=$hint; }//output the responseecho $response;?>
  4. I used the excellent PHP ajax live search from w3-schools http://www.w3schools.com/php/php_ajax_livesearch.asp for my webpage (www.allmanmedicin.se).It works perfectly in Firefox but not in IE. The problem is that as soon as the swedish characters å, ä or ö is used the only result from the form in IE is a square.It doesn't matter which character encoding I use. å, ä and ö are part of ASCII and of course UTF-8. But even when I check that the characterset of the page correctly is set to utf-8 in IE it doesn't work.No matter which character encoding I use it works brilliantly in Firefox but all my users have IE.Any idéas?
  • Create New...