Jump to content

Test Not Working?


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...