Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1

    Default javascript delay?


    Code:
    var obj = document.getElementById(divID);
    
    obj.innerHTML = "<img src='images/check.png' width='20' height='20'/>&nbsp;&nbsp;SUCCESSFULLY UPDATED DATA!";
    
    //DELAY
    
    //hide the div
    ing ana ako gusto buhatun. I tried puting sleep() but wala man ni effect. i just want a delay after the confirmation message.

    i also tried setTimeout, pero di sad mu gana. I don't know sad if sakto ako pag gamit ani nga function. mag try ko ug experiment2x to get the result.

    Any ideas to get the result would be greatly appreciated :> Thank you.

  2. #2

    Default Re: javascript delay?

    setTimeout("alert('hello')",2500);

  3. #3
    C.I.A. cliff_drew's Avatar
    Join Date
    Oct 2008
    Gender
    Male
    Posts
    4,571
    Blog Entries
    2

    Default Re: javascript delay?

    Put your script within a function and then use setTimeout to run the function.

    Delay in 5 seconds
    Code:
    MyDelay = setTimeout("YourFunction()",5000);

  4. #4

    Default Re: javascript delay?

    gi try nako. di japun mu gana T^T

  5. #5
    C.I.A. cliff_drew's Avatar
    Join Date
    Oct 2008
    Gender
    Male
    Posts
    4,571
    Blog Entries
    2

    Default Re: javascript delay?

    Quote Originally Posted by c-chan View Post
    gi try nako. di japun mu gana T^T
    Did you use alerts or pop-ups in your delay function? maybe your browser blocks it that's why it doesn't work.

  6. #6

    Default Re: javascript delay?

    no. i'm not using pop-ups

    Code:
    if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) 
    {
    obj2.innerHTML = XMLHttpRequestObject.responseText;
    obj.innerHTML = "<img src='images/check.png' width='20' height='20'/>&nbsp;&nbsp;SUCCESSFULLY UPDATED DATA!";
    }
    that's how the if function inside my ajax function looks like. I just wanted to show that confirmation message for about 5 secs.

    Code:
    if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) 
    {
    obj2.innerHTML = XMLHttpRequestObject.responseText;
    mydelay = setTimeout(hiddiv(),5000);
    }
    that's how it looked after. the hiddiv() function shows the confirmation message.

  7. #7

    Default Re: javascript delay?

    unsa imong server side ani bro PHP?

  8. #8

    Default Re: javascript delay?

    yes, it's php.

  9. #9

    Default Re: javascript delay?

    adto nalang ka mag set ug delay pwed raman cguro

    sleep(5);

  10. #10

    Default Re: javascript delay?

    ahmm...naka ajax man gud sya. so after niya ma receive ang response (which is gikan sa isa ka php nga page), iya dayun to ipa view ang confirmation message.

    waaa lisura i explain sa process T^T

  11.    Advertisement

Page 1 of 3 123 LastLast

Similar Threads

 
  1. javascript delay
    By c-chan in forum Programming
    Replies: 7
    Last Post: 07-29-2011, 06:03 AM
  2. Activation Mail request too much delayed!
    By lytbabe in forum Support Center
    Replies: 9
    Last Post: 03-14-2006, 05:50 PM
  3. Nokia N91 Has Been Delayed
    By samsungster in forum Gizmos & Gadgets (Old)
    Replies: 0
    Last Post: 09-22-2005, 12:01 PM
  4. wat does javascript:void means?
    By etgo in forum Computer Hardware
    Replies: 3
    Last Post: 09-12-2005, 07:36 AM
  5. PM delayed?
    By softtouch in forum Support Center
    Replies: 5
    Last Post: 07-12-2005, 09:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top