Jump to content

mrwutang

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Everything posted by mrwutang

  1. Yes you can, alleast in theory . But both the documents will have to be on your server, and with javascript you cannot change the document permanently. If none of these are a prolem to you then sure, you can do this. Make a script to open your child document in a window or frame. Then use the refernce from parent window to control the element .
  2. cool, good night homes. . Sometimes all you need is a good sleep.
  3. Wrapping the function inside a quote should solve your problem. If youre not sure try this code. javascript: function check(cnt){ alert("Timd Out "+cnt); parseInt(cnt); if(cnt<5){cnt++;setTimeout("check("+cnt+")",1000);}} check(0); It should execute 5 times every 1 second. So theres something wrong with the function youre tryin to execute.
  4. Ohkay try this function chatupdate(){ $(chatbox).load('chatbox.php'); chatupdate=function(){ chatupdate(); } setTimeout("chatupdate;", 1000); } Its some kind of a closure.
  5. Okay, "Object Expected"s the error message that you get when the functions expecting an object and youre passin a string or somethng else to it. Try adding this line to your code. Donno if itll help. function chatupdate(){ chatbox=document.getElementById('chatbox'); $(chatbox).load('chatbox.php'); setTimeout("chatupdate();", 1000); } chatupdate(); Or you must have some code somewhere which is set to accept the object. Can you post the whole javascript code here?
  6. I think youre usin a javascript library. jquery or somethin. I dont use it, so I onno much about the code :-\. If youre tryin to refresh the contents of div with id chatbox from the php code chatbox.php I can post the code to do that.
  7. ajax isnt workin? . What do you mean? The chat isnt updatin. Try lookin at the error console. What does it say?Or can you post the ajax code here?
  8. I had the same prolem a while ago too. You need to put the function in setTimeout inside quotes. function chatupdate(){ $('#chatbox').load('chatbox.php'); setTimeout("chatupdate()", 1000) } Try this.
  9. ajax is the answer to your prolem homes. . Get javascript on the clientside to send a "GET" request to the php on the server side and get php to echo the data. Ill post the codes if youre interested in this solution. If you want the reply to be stored as an array, use ">" or "<" to separate the data on the server usin php eg while(){ somethin; echo "$data>";}. The reason we're doin this is because we want to help javascript split each $data, so that when ajax gets the reply it can store it in a variable eg var data. And use split eg data=data.split(">"); to split the data and store it in an array. And then you can validate the data. Lemme know what you think,
  10. Like gevans said, its simple. create a <script> function changeImg(src){ document.getElementId('imgChng').src=src; } </script> Then create a text box whichll get the url and a button which will call the change function. <form onsubmit='javascript:return false;'> <input type='text' id='url'> <input type='button' onclick='javascript:changeImg(document.getElementById("url").value)'> </form> <img id='imgChng' src=''>. Create an empty image tag with no source and id. I think thatll do it. Din get the time to check the codes, so I donno if itll work. Try it out and tell me if theres any prolem with it.
  11. Okay lemme see if I got this right, you want to pass your javascript values to php? Im kinda new to php so Ill tell you what I know. An easier way would be to use get method. For eg, if you want to pass the value of var variable='somethin' to php try. document.location='website.com/code.php?var='+variable; Or use an iframe or popup window to pass the value along.And set your php code to$_GET the variable. $varible=$_GET['var'];and use it to pass the value to mysql. Theres a more complex way to do this too, if you wanna use POST method.Using ajax. Lemme know if you wanna know that. Ill give you the code. I can tell you more if you tell me more about your code. What do you want to do with this variable?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.