Jump to content

newrehmi

Members
  • Content Count

    35
  • Joined

  • Last visited

Everything posted by newrehmi

  1. THanks alot!!!! that help me much!!
  2. hello there, I have some sort of problem with date in javascript... lemme just post my code here... var currDate = new Date();var currDateEnd = new Date(); currDateEnd = currDate;currDateEnd.setDate(currDate.getDate()+7); alert(currDate); //I tried alert currDate here, and looks like this object (currDate) value has been changed to the value of currDateEnd I know there's other way to surpass this problem, but I want to know first why this is happening... Thanks a lot, very much...
  3. newrehmi

    Basic Cms In Php

    true. sometime I paper-pencil it first, then draw it using CSS.
  4. okay guys, hello how are you: I want to simply try using ajax in my codeigniter system. This is what I am trying to do, I ll write the example first: function downloadText(url, callbackFunction){var XMLHttpRequestObject = false;if (window.XMLHttpRequest){XMLHttpRequestObject = new XMLHttpRequest();}else if (window.ActiveXObject){XMLHttpRequestObject = newActiveXObject("Microsoft.XMLHTTP");}if(XMLHttpRequestObject){XMLHttpRequestObject.open("GET", url);XMLHttpRequestObject.onreadystatechange = function(){if (XMLHttpRequestObject.readyState == 4 &&XMLHttpRequestObject.status == 200){c
  5. thanks btw guys =) just looking which practice is good as a php scripter, so that I didn't developed a bad habit which will troublesome me later on..
  6. sorry, i've corrected some part.. hope you can see it clearly. Obviously, the statement of the second case is outside of php script.
  7. hello there w3teachers and friends. I have some question. I believe that I actually have wrote like a several tens of thousand line of script. But, just a few weeks ago, I met some script that changed a bit of my belief. Well, simply let me make turn the question into some example: case 1: <?phpif($foo == "foo"){echo "<span>some statement is running</span>";}?> case 2:<?phpif($foo != "foo"){?><span>theres no running statement</span><?php}?> okay, the example script that has changed my belief is the second case. So, my question is:1. which example d
  8. urgh, guys, sorry for my mistake!. I mistakenly used the same variable with $comment. Duh... am so stupid... =_+ hahaI corrected the variable now. <?php$user = $_GET['user'];$content = $_GET['comment'];$date = $_GET['date'];$fopen = fopen('comment.xml','r+');while(!feof($fopen)) { $comment = $comment.fgets($fopen); } $thecomment = str_replace('</commentdata>','',$comment);$newcomment = $thecomment.'<comment><user>'.$user.'</user><content>'.$content.'</content><date>'.$date.'</date></comment></commentdata>';fwrite(fopen('comment.x
  9. thanks for the answer. yeah. i learned constructing DOM using javascript before (creating element, attribute, node and etc), but I wonder if there's a connection or relation with the tutorial you posted.edit:at the end of the tutorial, did this statement created a new .xml or just echo the xml structure, so i just use responseXML in ajax.echo $xmlDoc->saveXML(); Thanks.
  10. thanks for answering.below is what i meant by scattered, after I submit a new comment:Before submit: <?xml version="1.0" encoding="iso-8859-1"?><commentdata></commentdata> After submit: test<?xml version="1.0" encoding="iso-8859-1"?><commentdata><comment><user>test</user><content>test<?xml version="1.0" encoding="iso-8859-1"?><commentdata></commentdata></content><date>6/8/2011</date></comment></commentdata> it should be working like this (after indent): <?xml version="1.0" encoding="is
  11. hello there,I have a problem of assigning GET array into a variable, but, without an assignment and I use the array instead, it worked. Below is the example:The example i tried below is working: <?php$fopen = fopen('comment.xml','r+');while(!feof($fopen)) { $comment = $comment.fgets($fopen); }$thecomment = str_replace('</commentdata>','',$comment);$newcomment = $thecomment.'<comment><user>'.$_GET['user'].'</user><content>'.$_GET['comment'].'</content><date>'.$_GET['date'].'</date></comment></commentdata>';fwrite(fopen('comment.xml
  12. yes thanks. without your answer, i couldn't trigger my brain anything about it though, i don't know anything about cache.Thanks
  13. Thank you sooo much deirde's father. Now it relief me >,< for knowing what is the problem now.
  14. yeah that's my complete script, the function is called in this part (bold), please re-check: once I submitted a new value, it will call function get(). It worked all the times, but sometimes it fails. I wonder why.Thanks for your times
  15. hello,i've finally been able to make a change to some text using fwrite. But i detected some bug that i didn't understand. First before anything, this is my script: function send() { if (XMLHttpRequest) { var http = new XMLHttpRequest(); } else { var http = new ActiveXObject('Microsoft.XMLHTTP'); } var thetext = document.getElementById('ajax_texttoinsert').value; var date = new Date(); thetext += ', <i>written on '+date.getHours()+':'+date.getMinutes()+'</i>'; http.open('GET','ajax_server.php?thetext='+thetext,true); http.send(null); http.onreadystatechange = function() {
  16. hello all,Finally i have been able to have a grasp in understanding xml structure, and accessing it through DOM. Then I continued my studies into Ajax, which i too has been able to have a bit grasp in understanding it. However, there's a still a few question puzzling in my mind about ajax.1. True that javascript were used to access xml through DOM, but, is there is any connection between method: createElement or setAttribute or anything, in term of altering XML so that the xml work as what I understand it should works in ajax (as a temporary storage).2. Or do we need to pass a parameter in XML
  17. Aside from this advanced subject, I hope the return statement has become more clear to you now, newrehmi. Feel free to come back if needed. yeah thanks guys... watching all this discussion has echoing so much knowledge and understanding that I still lack, although i didn't really understand a thing. However about the return statement, avoiding global and anonymous function, i will need to do more example, more test and more project to get a real grasp in it, as like what albert einstain said, the only source of knowledge is experience. I ll ask anything later, because I think now I need to di
  18. thanks a lot guys! =) bookmarked for my future reading and understanding. I have a lot of script that used global variable, now i am happy that it don't really make our browser slower. Just to care for the name conflict... because i don't really understand, without the use of global variable, how could I keep the data still 'living'.below is one of my simple script, i made last nite: <script type='text/javascript'>var text;var texttobePlaced;var theLoop = 0;function generateText() { text = document.getElementById('thetext').value; var textlength = text.length - 1 if (theLoop <= textl
  19. Thanks a lot everyone for the answer. May you elaborate more on this quote please? How to pass data from function to a function without declaring a global variable? Is it by always keep on re-accessing/creating the object? and what happened if the global space is polluted, will it make our browser very slow? Sorry for the noob question
  20. yeah, i just tried your example. It makes thing clearer now, so how about this code:<head><script type='text/javascript'>function calc(x,y) { var sum = x + y; var rum = x * y; return rum; return sum; }document.write(calc(5,2));</script></head> it does read the rum but not the sum, because the value is 10. So, is it because it only read the first return ever existed in a function?
  21. thank you for you time! sorry i posted just after you post, so i didnt read your post yet. Okay, i started to grasp just this part of return usage. How about other usage if you can give some example in some big project? i've made some lot of validation script, random generating, math, html re-styling and currently entering xml and etc, but never used this 'return' thingy.Thanks!
  22. thanks. I tried your suggestion, on which i moved the onsubmit='returnFalse()' to form.<form action='lol.php' method='get' onsubmit='returnFalse()'><input type='text' /><input type='submit' /></form> It still didn't work.But, when I replace the function in onsubmit='returnFalse()' with just a statement onsubmit='return false', it worked! so what is the explanation? <head><script type='text/javascript'>function returnFalse() { return false; }</script></head><body><form action='lol.php' method='get' onsubmit='return false'><input t
  23. hello all,first of all, i am sorry if this question is very noob. as if you want to know, i have made a lot of small project using javascript, but this question still stuck in my mind since I never use this 'return' thingy in any of my script. and have made some search through 6 pages of w3 javascript forum, just to grasp the concept of 'return' usage. So, if anyone could lend me a hand, in most simpler example just for me to grasp the concept, what does that thing do, because i believe this 'return' thing is a must know function for every programmer lived or I ll just live in a shame then..th
  24. If I succeed, I want to try to store more conditions in one IF. Let me add more example:var valuez1 = document.getElementById('valuename1').valuevar valuez2 = document.getElementById('valuename2').valuevar valuez3 = document.getElementById('valuename3').valuevar conditionz = (i == valuez1 || i == valuez2 || i == valuez3)for (i=0;i<=10;i++){if (conditionz){continue;}document.write(i)} actually, i will too try to make some looping script for valuez later, if I succeed...thanks so much for answering..edit:additional question, is there's any way to simplify this condition? If (i == valuez1 ||
×
×
  • Create New...