Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" >
<head>
<title>count down from 15</title>
<script type="text/javascript">
window.onload = function() {
/* set your parameters(
number to countdown from,
pause between counts in milliseconds,
function to execute when finished
)
*/
startCountDown(15, 1000, myFunction);
}
function startCountDown(i, p, f) {
// store parameters
var pause = p;
var fn = f;
// make reference to div
var countDownObj = document.getElementById("countDown");
if (countDownObj == null) {
// error
alert("div not found, check your id");
// bail
return;
}
countDownObj.count = function(i) {
// write out count
countDownObj.innerHTML = i;
if (i == 0) {
// execute function
fn();
// stop
return;
}
setTimeout(function() {
// repeat
countDownObj.count(i - 1);
},
pause
);
}
// set it going
countDownObj.count(i);
}
function myFunction() {
alert("hi alex");
}
</script>
</head>
<body>
<div id="countDown"></div>
</body>
</html>
ik zie een ajax script staan maar begrijp nog niet hoe het werkt, hoe ik dat hier kan implenteren en voornaamlijk hoe ik dan php kan aansturen?Check dit topic:
http://www.helpmij.nl/forum/showthread.php?t=385629
Staat een volledig werkend ajax script. Daarmee zou je verder moeten komen :thumb:
//js
function Async(){
var objXml = false;
if(navigator.appName == "Microsoft Internet Explorer") {
objXml = new ActiveXObject("Microsoft.XMLHTTP");
}else{
objXml = new XMLHttpRequest();
}
this.newObj = objXml;
}
function RequestAFile(filename,asyncobj){
asyncobj.open("GET", filename, true);
asyncobj.onreadystatechange=function() {
if(asyncobj.readyState == 4) {
alert('de contents van deze file zijn: ' + asyncobj.responseText);
}
}
asyncobj.send(null);
}
//js
var omgwtf = new Async();
RequestAFile('mijnphpfile.php',omgwtf.newObj);
hoe kan ik dat doen want ik kan niet een bestand.php?id=<? echo $id ; ?> gewoon invoegen op de plaats waar ik het bestand aanroep.
RequestAFile('bestand.php?id='+id,omgwtf.newObj);
<script type="text/javascript">
RequestAFile('bestand.php?id=<?php echo $id; ?>',omgwtf.newObj);
</script>
//dit is het .php bestand
<?php
$id = 42;
?>
<script type="text/javascript">
RequestAFile('bestand.php?id=<?php echo $id; ?>',omgwtf.newObj);
</script>
<script type="text/javascript">
RequestAFile('bestand.php?id=42',omgwtf.newObj);
</script>
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.