javascript - How to call dynamic URL in jquery function? -


how can call url after end of event time each timer below? pass code of countdown. need find place url, hyperlink image after timer display, after time ended picture show undefined url link. declare variable = +match_link+ show link after event:

var match_link = digits[elem].parent().parent().parent().children('.match-info').children('a:first-child').attr('href');           digits[elem].parent().parent().html('<a href="'+match_link+'" class="live-now"><img width="145" height="35" src="http://files.barcelonastream.com/media-resources/other/watchnow.png" class="attachment-medium" alt="watchnow" title="watchnow"></a>'); 

<html>    <head>  <script type="text/javascript">  //<![cdata[  try{if (!window.cloudflare) {var cloudflare=[{verbose:0,p:0,byc:0,owlid:"cf",bag2:1,mirage2:0,oracle:0,paths:{cloudflare:"/cdn-cgi/nexp/dok3v=1613a3a185/"},atok:"cc11de0e81b190b819ea8d9a1ae30b94",petok:"bebab39309d8af2d0876cf8ed34772ef3629ea6f-1443543175-1800",zone:"realmadridlive.in",rocket:"a",apps:{}}];document.write('<script type="text/javascript" src="//ajax.cloudflare.com/cdn-cgi/nexp/dok3v=e9627cd26a/cloudflare.min.js"><'+'\/script>');}}catch(e){};  //]]>  </script>    <script type="text/rocketscript" data-rocketsrc="http://realmadridlive.in/js/jquery-1.8.3.min.js"></script>    <script type="text/javascript">      jquery.fn.countdown = function(useroptions)  {    // default options    var options = {      steptime: 60,      // starttime , format must follow same format.      // cannot specify format unordered (e.g. hh:ss:mm wrong)      format: "dd:hh:mm:ss",      eventtime: "jan, 1, 2014, 00:00",      digitimages: 6,      digitwidth: 53,      digitheight: 77,      timerend: function(){},      image: "digits.png"    };    var digits = [], interval;       useroptions.starttime = timeleft(useroptions.eventtime);       // draw digits in given container    var createdigits = function(where)    {      var c = 0;      var tempstarttime = options.starttime;      // iterate each starttime digit, if not digit      // we'll asume it's separator      (var = 0; < options.starttime.length; i++)      {        if (parseint(tempstarttime.charat(i)) >= 0)        {          elem = jquery('<div id="cnt_' + + '" class="cntdigit" />').css({            height: options.digitheight * options.digitimages * 10,            float: 'left', background: 'url(\'' + options.image + '\')',            width: options.digitwidth});          digits.push(elem);          margin(c, -((parseint(tempstarttime.charat(i)) * options.digitheight *                                options.digitimages)));          digits[c].__max = 9;          // add max digits, example, first digit of minutes (mm) has          // max of 5. conditional max used when left digit has reach          // max. example second "hours" digit has conditional max of 3                             switch (options.format.charat(i)) {            case 'h':              digits[c].__max = (c % 2 == 0) ? 2: 9;              if (c % 2 != 0)                digits[c].__condmax = 3;              break;            case 'd':              digits[c].__max = 9;              break;            case 'm':            case 's':              digits[c].__max = (c % 2 == 0) ? 5: 9;          }          ++c;        }        else          elem = jquery('<div class="cntseparator"/>').css({float: 'left'})                  .text(tempstarttime.charat(i));                                                           where.append('<div>');                          where.append(elem);                          where.append('</div>');      }    };       // set or element margin    var margin = function(elem, val)    {      if (val !== undefined)        return digits[elem].css({'margintop': val + 'px'});         return parseint(digits[elem].css('margintop').replace('px', ''));    };       // makes movement. done "digitimages" steps.    var movestep = function(elem)    {      digits[elem]._digitinitial = -(digits[elem].__max * options.digitheight * options.digitimages);      return function _move() {        mtop = margin(elem) + options.digitheight;        if (mtop == options.digitheight) {          margin(elem, digits[elem]._digitinitial);          if (elem > 0) movestep(elem - 1)();          else          {            clearinterval(interval);            (var i=0; < digits.length; i++) margin(i, 0);            options.timerend();            var match_link = digits[elem].parent().parent().parent().children('.match-info').children('a:first-child').attr('href');            digits[elem].parent().parent().html('<a href="'+match_link+'" class="live-now"><img width="145" height="35" src="http://files.barcelonastream.com/media-resources/other/watchnow.png" class="attachment-medium" alt="watchnow" title="watchnow"></a>');               return;          }          if ((elem > 0) && (digits[elem].__condmax !== undefined) &&              (digits[elem - 1]._digitinitial == margin(elem - 1)))            margin(elem, -(digits[elem].__condmax * options.digitheight * options.digitimages));          return;        }           margin(elem, mtop);        if (margin(elem) / options.digitheight % options.digitimages != 0)          settimeout(_move, options.steptime);           if (mtop == 0) digits[elem].__ismax = true;      }    };       jquery.extend(options, useroptions);    this.css({height: options.digitheight, overflow: 'hidden'});    createdigits(this);    interval = setinterval(movestep(digits.length - 1), 1000);  };     function timeleft(eventtime) {          var = new date();          var now_utc = new date(now.getutcfullyear(), now.getutcmonth(), now.getutcdate(), now.getutchours(), now.getutcminutes(), now.getutcseconds());          var event_time = new date(eventtime);                            var t1 = now_utc.gettime();          //removes 1 hour date - 60 minutes * 60 seconds * 1000 miliseconds - -60*60*1000          var t2 = event_time.gettime();          var time_left = new date(parseint(t2-t1));          if(time_left<0) {                  return "00:00:00:00";          }          msperday = 24 * 60 * 60 * 1000;          days = math.floor(time_left/msperday);          if (days < 10) { days = "0"+days; }          hours = time_left.getutchours();          if (hours < 10) { hours = "0"+hours;}          minutes = time_left.getutcminutes();          if (minutes < 10) { minutes = "0"+minutes; }          seconds = time_left.getutcseconds();          if (seconds < 10) { seconds = "0"+seconds; }                   return(days+":"+hours+":"+minutes+":"+seconds);  }  </script>  </head>  <body>    <div id="sct_id_0" class="simple_countdown_timer" style="width: 150px; margin: auto;">  <div class="sct_count" style="height: 19px; vertical-align: middle; overflow: hidden;"></div>  <div class="desc c1">  <div>days</div>  <div>hours</div>  <div>min</div>  <div class="secs">sec</div>    <script type="text/rocketscript">  jquery(function(){  	jquery('#sct_id_0 .sct_count').countdown({  		image: 'http://i.imgur.com/4xw40ya.png',  		format: "dd:hh:mm:ss",  		// jan,19,2015,16:00  		eventtime: "sep,29,2015,18:45",  		digitwidth: 13,  		digitheight: 19,  	});  });  </script></div>      </div>    script code not working in stackoverflow iframe script         <iframe src="http://realmadridlive.in/mrk-schedule.php" /></iframe>            </body>    </html>

if understand right, may use .html function https://jsfiddle.net/3ws247hh/

$('#sct_id_0').html("<img src='http://findicons.com/icon/download/169459/alert/128/png' /> ") 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -