Refresh
(EDIT: ik las hele code niet.)
Je hoeft opzicht geen refresh te gebruiken, de gebruikers gaan zelf rond de website, dus zien ze het automatisch wel.
Gewijzigd op 12/02/2011 01:16:33 door Marco Bos
<body>
<script type="text/javascript">
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("No AJAX!?");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.open("GET","http://www.example.com/the_page_that_contains_the_div_content",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout('Ajax()',10000);
}
</script>
<div id="ReloadThis">Default text</div>
</body>
</html>
Toevoeging op 12/02/2011 01:29:52:
waarom tels het niet af of wat doe ik hier soms verkeerd?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<script type="text/javascript">
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("No AJAX!?");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadinbox').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadcrimes').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadgta').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadgym').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadoc').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.open("GET","http://www.example.com/the_page_that_contains_the_div_content",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout('Ajax()',10000);
}
</script>
<div id="right" class="s">
<div class="side_header">Crimes Stats</div>
<div class="side_content_menu">
<ul class="list_side">
<ul class="list_side">
<div id="Reloadinbox"><?
if ($inboxnew > 0) { echo "<a href=\"../../message.php?p=inbox\"><img src=\"new_message.png\"></a>"; }
?>
</div>
<tr>
<div id="ReloadTcrimes"><b>Crimes:<<? if($diff == "Now"){print "{$diff}";}elseif($diff >= -1){print "{$diff0}";} ?></div>
</tr>
<tr>
<div id="ReloadTGta"><b>Gta:<? if($diff3 == "Now"){print "{$diff3}";}elseif($diff3 >= -1){print "{$diff30}";} ?></div>
</tr>
<tr>
<div id="ReloadTOc"><b>Oc:<? if($diff2 == "Now"){print "{$diff2}";}elseif($diff2 >= -1){print "{$diff20}";} ?></div>
</tr>
<tr>
<div id="ReloadGym"><b>Gym:<? if($diff4 == "Now"){print "{$diff4}";}elseif($diff4 >= -1){print "{$diff40}";} ?></div>
</tr>
<tr>
</ul>
</div>
[size=xsmall][i]Toevoeging op 12/02/2011 02:09:27:[/i][/size]
iemand enige idees waaom ik op een andere link click dat het niet refresht alleen maar wanneer ik juist op de pagina kom
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("No AJAX!?");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadinbox').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadcrimes').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadgta').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadgym').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('Reloadoc').innerHTML=xmlHttp.responseText;
setTimeout('Ajax()',10000);
}
}
xmlHttp.open("GET","http://www.example.com/the_page_that_contains_the_div_content",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout('Ajax()',10000);
}
</script>
<div id="right" class="s">
<div class="side_header">Crimes Stats</div>
<div class="side_content_menu">
<ul class="list_side">
<ul class="list_side">
<div id="Reloadinbox"><?
if ($inboxnew > 0) { echo "<a href=\"../../message.php?p=inbox\"><img src=\"new_message.png\"></a>"; }
?>
</div>
<tr>
<div id="ReloadTcrimes"><b>Crimes:<<? if($diff == "Now"){print "{$diff}";}elseif($diff >= -1){print "{$diff0}";} ?></div>
</tr>
<tr>
<div id="ReloadTGta"><b>Gta:<? if($diff3 == "Now"){print "{$diff3}";}elseif($diff3 >= -1){print "{$diff30}";} ?></div>
</tr>
<tr>
<div id="ReloadTOc"><b>Oc:<? if($diff2 == "Now"){print "{$diff2}";}elseif($diff2 >= -1){print "{$diff20}";} ?></div>
</tr>
<tr>
<div id="ReloadGym"><b>Gym:<? if($diff4 == "Now"){print "{$diff4}";}elseif($diff4 >= -1){print "{$diff40}";} ?></div>
</tr>
<tr>
</ul>
</div>
[size=xsmall][i]Toevoeging op 12/02/2011 02:09:27:[/i][/size]
iemand enige idees waaom ik op een andere link click dat het niet refresht alleen maar wanneer ik juist op de pagina kom
#zet dit tussen head
<script>
function vernieuwen(){
* *parent.FRAMENAAM.location = parent.FRAMENAAM.location;
}
</script>
#einde head
#dit waar je een button wilt voor refresh
<input type="button" value="vernieuwen" onclick="javascript:vernieuwen()" />
groeten en suc6,
raymond
Gewijzigd op 14/02/2011 12:23:57 door raymond van Os