Jump to content

argonz

Members
  • Posts

    12
  • Joined

  • Last visited

argonz's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. OK Guys..! Never Mind ! I figure it out now.. Thank a lot for your kindly helping !
  2. I don't understand what u mean.., My English is so bad.., could you give me the sample code how to use PHP to write the value in JavaScript !@dsonesuk : I've tried as your code, but its does not work. I don't understand that code mean. Is it OK PHP code in JavaScript code.<script type="text/javascript">textarray = new Array();<?phpmysql_select_db("belajar",mysql_connect("localhost","root",""));$result = mysql_query("select * from delay where id = $id");while ($row = mysql_fetch_assoc($result)){ echo 'textarray['.$row['id'].']="'.$row['text'].'";}?></script> that code doesn't work..!
  3. ?phpmysql_select_db("belajar",mysql_connect("localhost","root",""));function cetak($id){ $query = mysql_query("select * from delay where id = $id"); $row = mysql_fetch_array($query); echo $row[text];}?><script type="text/javascript">var waktu=0; function timer(time,id){ alert("test ji"); if(waktu==time){ document.write("<?php echo cetak("+id+"); ?>"); } setTimeout("timer(time,id)",1000); waktu++;}timer(1,1);timer(3,2);timer(5,3);</script> I write like above but it does not work, I hv no idea where is the wrong of the code.
  4. e.g : my database---------------------------id | text | time |---------------------------1 | print1 | 3 |---------------------------2 | print2 | 5 |--------------------------3 | print3 | 2 |--------------------------I want the field text show base on time, field time is the duration of the text should be show before the next text appear.detail :page onload(1st second) --> print1 showat the 4th second --> print2 show at the 9th second --> print3 showhow to do that ?Best Regards !
  5. sound_ajax.html <script type="text/javascript" src="sound_ajax.js"></script><html><body onLoad="sound_ajax()"><div id="txtHint"> Disini soundnya </div></body></html> sound_ajax.php <?phpmysql_select_db("belajar",mysql_connect("localhost","root",""));$query = "select * from sound where id = 3";$result = mysql_query($query);$play = mysql_fetch_array($result);echo "<embed src='$play[pathsound]'><br />";echo "$play[pathsound]";?> sound_ajax.js function sound_ajax(){ xmlhttp = GetXmlHttpObject(); var url = "sound_ajax.php"; url=url+"?sid="+Math.random(); xmlhttp.onreadystatechange = stateChange; xmlhttp.open("GET",url,true); xmlhttp.send(null);}function GetXmlHttpObject(){ try{ xmlhttp = new XMLHttpRequest(); } catch (e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try { xmlhttp = new ActiveXObjec("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser does not support Ajax !"); return false; } } } return xmlhttp;}function stateChange(){ if(xmlhttp.readyState == 4){ if(xmlhttp.status == 200){ document.getElementById("txtHint").innerHTML = xmlhttp.responseText; } }} when I'm not using ajax the sound can play but neither with ajaxany body could help me please !
  6. Now its work fine on both browser (IE, Firefox)this code : myForm.page.value should be : document.myForm.page.value thnku !
  7. no.., when page load alert() doesn't appear, and the php is called and give value is 1for first time click alert() appear with value 1 and than php is called and give value is 2but for the second time click alert () still appear with the value 1.. it should be 2 because php have given the value 2 in the first time clicknow it's work in IE, before I'm using in Firefox,so how do it can be compatible cross-browser ?any suggestion ?
  8. when the page load alert() is not executed because alert will be executed only if str != startwhen proses onclick then str = 'proses' $page = 2but alert() show that str : proses myForm.page.value : 1 page : 1 that it should be 2 its confusing, because in the browser input text show the value is 2 but in alert() is 1check here http://www.yamaclub.com/1/phpajax.html
  9. php send text to responseText but it does not work correctly this the code :phpajax.html <script type="text/javascript" src="phpajax.js"></script><html><body onLoad="phpajax('start')"><div id="txtHint"></div></body></html> phpajax.js function phpajax(str){xmlhttp = GetXmlHttpObject();var url = "phpajax.php";var page;if (str != 'start'){page = myForm.page.value;alert("str : "+str+" myForm.page.value : "+myForm.page.value+" page : "+page);}url=url+"?str="+str;url=url+"&page="+page;url=url+"&sid="+Math.random();xmlhttp.onreadystatechange = stateChange;xmlhttp.open("GET",url,true);xmlhttp.send(null);}function GetXmlHttpObject(){try{xmlhttp = new XMLHttpRequest();} catch (e){try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e){try {xmlhttp = new ActiveXObjec("Microsoft.XMLHTTP");} catch (e){alert("Your browser does not support Ajax !");return false;}}}return xmlhttp;}function stateChange(){if(xmlhttp.readyState == 4){document.getElementById("txtHint").innerHTML = xmlhttp.responseText;}} phpajax.php <?php$str = $_GET['str'];$page = $_GET['page'];if($str == "start"){$page = 1;} else {$page = $page + 1;}echo "<form name='myForm'>";echo "<input type='text' name='page' id='page' value='$page'>";echo "<input type='button' id='proses' name='proses' value='proses' onclick='phpajax(this.value)'>";echo "</form>";echo "str : ".$str." myForm.page.value : ".$page." page : ".$page;?> when click proses for the second time echo "<input type='text' name='page' id='page' value='$page'>"; show the value 2 in txtHintbut in alert("str : "+str+" myForm.page.value : "+myForm.page.value+" page : "+page); the value is still 1i have no idea, why it can be like that..any idea ?
  10. oh sorry, I forgot to write echo.., I need "index.php?page=view.php" to include view.php in index.php. but, about the problem, I've got the solution. I put "&" and write variable again, like this : echo "<a href='index.php?page=view.php&catid=$query3[category_id]'>$query3['category_nm']</a>"; in the past, i don't know how to use 2 variable or more in url. but with & its done.thank you for asking me to use {}, single quote.., even it work fine for me. but I've read that its required to completely cross-platform compatible.., isn't it ?
  11. e.g table : categoryfile :category_idcategory_nmand I have menu.php $query1 = "select * from category";$query2 = mysql_query($query1);while($query3 = mysql_fetch_array($query2)){<a href=index.php?page=view.php>$query3[nm_category]</a><br />// another script} for example, there are 3 record in category. computer, law, medicali need variable in view.php from menu.php to identify which data will show in view.php according to category !how do it can be done ?
  12. Hi..! I'm Argonz.. Nice to meet you all, hope can learn here
×
×
  • Create New...