JSQuery/PHP Chat virker ikke i IE7-
Hej.Jeg har en chat, der fungerer helt perfekt i IE8, firefox, Safari og Chrome.
Men i IE7 virker den overhovedet ikke. Den henter ikke log.php i den div, som den gør i de andre, så man kan intet se.
Hvis man submitter laver den også en fejl, ved at den automatisk lavet en "GET" action og kommer hen på samme side med ?var=blabla.
Håber meget der er en der kan hjælpe :)
Her er min kode
<div id="chatbox"><?php
$handle = fopen("log.php?s_id=$_GET[s_id]", "r");
$contents = fread($handle, filesize($handle));
fclose($handle);
echo $contents;
?></div>
<form name="message">
<table><tr><td>
<input name="usermsg" type="text" id="usermsg" size="63" value="Write to come online" onfocus="tbTest_focus(event,this)" />
<input type="text" style="display:none" /></td><td>
<input name="submitmsg" type="submit" id="submitmsg" class="gradientblaa submitchat" value="Say It" /></td></tr></table>
</form></div>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
// jQuery Document
$(document).ready(function(){
//If user submits the form
$("#submitmsg").click(function(){
var clientmsg = $("#usermsg").val();
$.post("chat_post.php?s_id=<?php echo "$_GET[s_id]";?>", {text: clientmsg});
$("#usermsg").attr("value", "");
return false;
});
//Load the file containing the chat log
function loadLog(){
var oldscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
$.ajax({
url: "log.php?s_id=<?php echo "$_GET[s_id]";?>",
cache: false,
success: function(html){
$("#chatbox").html(html); //Insert chat log into the #chatbox div
var newscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
if(newscrollHeight > oldscrollHeight){
$("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal'); //Autoscroll to bottom of div
}
},
});
}
setInterval (loadLog, 2500); //Reload file every 2.5 seconds
//If user wants to end session
$("#exit").click(function(){
var exit = confirm("Are you sure you want to end the session?");
if(exit==true){window.location = 'index.php';}
});
});
</script>