Jump to content

Test Not Working?


Cod-nes

Recommended Posts

I'm trying to add a music player when a certain ajax file has the word "needed" f0r example. This was my attempt but I failed:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Domestic Aid/Pomoc Domowa</title><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><style type="text/css">body {font-family:"Times New Roman";font-size: 14pt;background-color: #CCCCFF;}.big {background-color: #33CCCC;font-size: 26pt;border-bottom: 5px solid #000000;border-top: 1px solid #000000;border-right: 1px solid #000000;border-left: 1px solid #000000;padding: 10px;}.small {padding:5px;border: 1px solid #000000;border-top-style: none;}</style><script type="text/javascript" src="swfobject.js"></script><script type="text/javascript">function reload() {window.location.replace('index.php');return;}function load(pomoc) {var text = "<form action='index.php'><input type='button' value='Send Help/Wyslij Pomoc' onclick='load(\"send\")'> <input type='button' value='Receive Cry of Help/Otrzymuja Wolanie o Pomoc' onclick='load(\"receive\")'><br><a href='index.php?pomoc=delete'>Remove Cookie/Usunac cookie</a></form>";if(pomoc == 'send') {var text2 = "<br>Send Help/Wyslij Pomoc<br><form action='index.php'><input type='button' value='On' onclick='send(\"ON\")'> <input type='button' value='Off' onclick='send(\"OFF\")'></form><div id='ss'></div>";document.getElementById("s").innerHTML=text;document.getElementById("s").innerHTML+=text2;}else if(pomoc == 'receive') {document.getElementById("s").innerHTML=text + "<div id='ss'></div>";receive();}else {document.getElementById("s").innerHTML=text;}}function send(status) {if(status == 'ON') {var status = '1';sendstatus(status);}if(status == 'OFF') {var status = '0';sendstatus(status);}}function GetXmlHttpObject(){if (window.XMLHttpRequest)  {  // code for IE7+, Firefox, Chrome, Opera, Safari  return new XMLHttpRequest();  }if (window.ActiveXObject)  {  // code for IE6, IE5  return new ActiveXObject("Microsoft.XMLHTTP");  }return null;}var xmlhttp;function receive(){xmlhttp=GetXmlHttpObject();if (xmlhttp==null)  {  alert ("Browser does not support HTTP Request");  return;  }var url="index.php?pomoc=receive";url=url+"&sid="+Math.random();xmlhttp.onreadystatechange=stateChanged;xmlhttp.open("GET",url,true);xmlhttp.send(null);setTimeout('receive()',60000);}function stateChanged(){if (xmlhttp.readyState==4){document.getElementById("ss").innerHTML=xmlhttp.responseText;if(xmlhttp.responseText.test(/needed/) == true) {var so = new SWFObject("playerMini.swf", "mymovie", "75", "30", "7", "#FFFFFF");so.addVariable("autoPlay", "no");so.addVariable("soundPath", "song.mp3");so.write("flashPlayer");}}}var xmlhttp2;function sendstatus(status){xmlhttp2=GetXmlHttpObject();if (xmlhttp2==null)  {  alert ("Browser does not support HTTP Request");  return;  }var url="index.php?pomoc=send";url=url+"&sn="+status+"&sid="+Math.random();xmlhttp2.onreadystatechange=stateChanged2;xmlhttp2.open("GET",url,true);xmlhttp2.send(null);}function stateChanged2(){if (xmlhttp2.readyState==4){document.getElementById("ss").innerHTML='Sent Cry of Help/Przeslane Wolanie o Pomoc';}}</script></head><body><div class='big' id='b'>Domestic Aid/Pomoc Domowa</div><div class='small' id="s"><form action='index.php'><input type='button' value='Send Help/Wyslij Pomoc' onclick='load("send")'> <input type='button' value='Receive Cry of Help/Otrzymuja Wolanie o Pomoc' onclick='load("receive")'><br><a href='index.php?pomoc=delete'>Remove Cookie/Usunac cookie</a></form></div><div id='flashPlayer'></div></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...