Hey, jeg er ny i ajax, og er ved at lave en hjemmeside til en CS
clan.
på siden bruger jeg ajax til links osv. så billederne ikke skal loades hver gang siden skifter.
her er min index.php (med ajax koden):
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
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("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","test.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("side=");
}
setTimeout("loadXMLDoc()",1);
function loadXMLDooc()
{
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("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","test.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("side=profil");
}
</script>
<title>designfrag</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body style=" background: url(bg.jpg);" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<!-- Save for Web Slices (designfrag.psd) -->
<table id="Table_01" width="1001" border="0" cellpadding="0" cellspacing="0">
<tr>
<td rowspan="17">
<img src="images/index_01.png" width="50" height="278" alt=""></td>
<td rowspan="17">
<img src="images/index_02.png" width="28" height="278" alt=""></td>
<td colspan="3" rowspan="6" width="204" height="50" style=" background: url(images/sideanvisning.png);"></td>
<td rowspan="6">
<img src="images/index_04.png" width="32" height="50" alt=""></td>
<td colspan="8">
<img src="images/index_05.png" width="608" height="1" alt=""></td>
<td colspan="2" rowspan="2">
<img src="images/index_06.png" width="28" height="25" alt=""></td>
<td rowspan="3">
<img src="images/index_07.png" width="50" height="26" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="8">
<img src="images/index_08.png" width="608" height="24" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="24" alt=""></td>
</tr>
<tr>
<td colspan="6" rowspan="2">
<img src="images/index_09.png" width="351" height="14" alt=""></td>
<td rowspan="9">
<img src="images/index_10.png" width="71" height="157" alt=""></td>
<td colspan="2" rowspan="10" width="199" height="161" style=" background: url(images/adminpanel_place.png);"></td>
<td rowspan="15">
<img src="images/index_12.png" width="15" height="253" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td rowspan="14">
<img src="images/index_13.png" width="50" height="252" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="13" alt=""></td>
</tr>
<tr>
<td colspan="4">
<img src="images/index_14.png" width="163" height="1" alt=""></td>
<td colspan="2">
<img src="images/fraggit_banner_link.png" width="188" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/index_16.png" width="43" height="10" alt=""></td>
<td colspan="2" rowspan="11">
<img src="images/index_17.png" width="121" height="196" alt=""></td>
<td rowspan="4">
<img src="images/fraggit_banner_link-19.png" width="187" height="57" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="10" alt=""></td>
</tr>
<tr>
<td colspan="6">
<img src="images/index_19.png" width="277" height="11" alt=""></td>
<td rowspan="4">
<img src="images/index_20.png" width="2" height="67" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="11" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="9">
<img src="images/index_21.png" width="16" height="175" alt=""></td>
<td colspan="4">
<img src="images/index_22.png" width="261" height="3" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="3" alt=""></td>
</tr>
<tr>
<td colspan="3" rowspan="5" width="234" style=" background: url(images/login_box.png);">
</td>
<td rowspan="2">
<img src="images/index_24.png" width="27" height="53" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="33" alt=""></td>
</tr>
<tr>
<td rowspan="6">
<img src="images/index_25.png" width="187" height="110" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="20" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="3">
<img src="images/login_fane.png" width="29" height="77" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="65" alt=""></td>
</tr>
<tr>
<td rowspan="3">
<img src="images/index_27.png" width="71" height="19" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="4" alt=""></td>
</tr>
<tr>
<td rowspan="4">
<img src="images/index_28.png" width="186" height="50" alt=""></td>
<td rowspan="5">
<img src="images/index_29.png" width="13" height="92" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
<tr>
<td colspan="4" rowspan="3">
<img src="images/index_30.png" width="261" height="42" alt=""></td>
<td rowspan="3">
<img src="images/index_31.png" width="2" height="42" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="7" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="images/index_32.png" width="71" height="35" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="6" alt=""></td>
</tr>
<tr>
<td>
<img src="images/index_33.png" width="187" height="29" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="29" alt=""></td>
</tr>
<tr>
<td colspan="12" width="844" height="42" style=" background: url(images/menu.png);" align="center">
<p style="color: #FFF;" id="pointer">
<b onClick="loadXMLDoc()">Home</b>
- <b onClick="loadXMLDooc()">Anden side</b>
</p>
</td>
<td>
<img src="images/spacer.gif" width="1" height="42" alt=""></td>
</tr>
<tr>
<td colspan="3" width="81" height="687" style=" background: url(images/midt_left_border.png);">
</td>
<td colspan="11" height="" width="841" style="background: #222222;" valign="top">
<div id="myDiv" width="841">
</div>
</td>
<td colspan="3" width="78" height="687" style=" background: url(images/midt_right_border.png);">
</td>
<td>
<img src="images/spacer.gif" width="1" height="687" alt=""></td>
</tr>
<tr>
<td>
<img src="images/index_38.png" width="50" height="35" alt=""></td>
<td>
<img src="images/index_39.png" width="28" height="35" alt=""></td>
<td>
<img src="images/index_40.png" width="3" height="35" alt=""></td>
<td colspan="11">
<img src="images/bund.png" width="841" height="35" alt=""></td>
<td colspan="3">
<img src="images/index_42.png" width="78" height="35" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="35" alt=""></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="50" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="28" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="3" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="13" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="188" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="32" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="14" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="27" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="2" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="120" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="187" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="71" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="186" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="13" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="15" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="50" height="1" alt=""></td>
<td></td>
</tr>
</table>
</center>
<!-- End Save for Web Slices -->
</body>
</html>
den er uploadet på denne side: www.fraggit.dk/ny
Håber i kan hjælpe mig