www.webdeveloper.com
Results 1 to 2 of 2

Thread: small project needs help.

  1. #1
    Join Date
    Nov 2013
    Posts
    1

    small project needs help.

    Hi,

    This is a long shot but I realized problem went over my head.
    I have a java script that, downloads bunch of daily comics. Its function to generate date, and formatting.
    You can find it here
    I'm a graphics artist, not a programmer, scrapped it out from various snippets, and somehow managed it to work.
    What I really wish is a select date function, so it can display comics for previous days.
    But my knowledge stopped at 'how to reload the image once its displayed problem'

    So: my questions:
    How difficult it is to do? Could I expect anyone to do that out of good will, if so,
    Can anyone help me out by fixing it? cause I have no idea where to start.

  2. #2
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,683
    the src if generated based on the year month and day

    so last weeks or any days comic strip can be accessed so long a an image is available for that day

    but you display captions these cannot be generated

    in principle

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    </head>
    
    <body>
    <img id="strip" src="http://images.ucomics.com/comics/ga/2013/ga131106.gif" />
    <input type="button" name="" value="Previous" onmouseup="zxcStrip.Previous('strip',-1);" />
    <input type="button" name="" value="Next" onmouseup="zxcStrip.Previous('strip',1);" />
    
    
    <script type="text/javascript">
    /*<![CDATA[*/
    
    var zxcStrip={
    
     Previous:function(id,ud){
      var o=this[id],ud=typeof(ud)=='number'&&ud>0?1:-1,i=new Image();
      if (o&&o.os+ud<0){
       o.os+=ud;
       clearTimeout(o.to);
       i.src=o.b+o.today.getFullYear()+'/ga'+(o.today.getFullYear()%100)+(o.today.getMonth()+1)+this.fn(o.today.getDate()+o.os)+'.gif';
       this.load(o,i);
      }
     },
    
     init:function(o){
      var id=o.ImageID,b=o.BaseURL,img=document.getElementById(id);
      if (img&&!this[id]){
       o.img=img;
       o.b=b;
       o.today=new Date();
       o.os=0;
       this[id]=o;
       this.Previous(id,-1);
      }
     },
    
     load:function(o,i){
      var oop=this;
      if (i.width<40){
       o.to=setTimeout(function(){ oop.load(o,i); },100);
      }
      else {
       o.img.src=i.src;
      }
     },
    
    
     fn:function(n){
      return (n<10?'0':'')+n;
     }
    
    
    }
    
    zxcStrip.init({
     ImageID:'strip',
     BaseURL:'http://images.ucomics.com/comics/ga/'
    });
    
    /*]]>*/
    </script>
    
    </body>
    
    </html>
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles