Results 1 to 5 of 5

Thread: Update the script..

  1. #1
    Join Date
    Nov 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Update the script..

    Hello,

    I use below code to refresh my image verification codes, when an user click on the refresh button, javascript code will be refresh image code.. but I need to tweak that my code..

    PHP Code:
    <script type="text/javascript">
              function 
    reload() {
                var 
    now=new Date();
                var 
    a=document.getElementById('reload');
                
    a.src='img.php?'+now.getTime();
              }
            
    </script> 
    I want to change below line:
    a.src='img.php?'+now.getTime();

    with:

    img.php?+now.getTime(); + size=6

    It means when an user click on the refresh button it should be call img.php?size=6 URL..

    Regards.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
              function reload() {
                document.getElementById('reload').src = "img.php?" + (new Date()).getTime() + "&size=6";
              }
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Nov 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    Code:
              function reload() {
                document.getElementById('reload').src = "img.php?" + (new Date()).getTime() + "&size=6";
              }
    First of all thank you very much for your FAST reply That's what I need..

    By the way, I would like to learn;
    a) What means new_date and why we should put this line into script
    b) How do I re-update the code again with below feature;
    b1) document.getElementById('reload').src = "img.php?" + (new Date()).getTime() + "&size=$MAIN["imageverify"]";

    $MAIN["imageverify"] is a php value that I choose from my admin panel.

  4. #4
    Join Date
    Nov 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok I did it, thanks again
    PHP Code:
    <script type="text/javascript">
              function reload() {
                document.getElementById('reload').src = "img.php?" + (new Date()).getTime() + "&size=<?=$MAIN[imageverify]?>";
              }
            </script>

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The new Date() bit is exactly the same as what you did above, but simply avoiding the variables, which aren't necessary since you only use them once.
    You missed some quotes out of that code, around imageverify.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •