javascript console输出图片?

时间:2022-05-07
本文章向大家介绍javascript console输出图片?,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

比百度还会玩,来自天天动听http://www.dongting.com/,挺有意思的,mark一下,chrome可以火狐不可以。

code:

!function (textArray) {
  var styleRe = /{([^}]+)}/g;
  try {
    if (window.console && window.console.log) {
      var i,
      len,
      text,
      args;
      for (i = 0, len = textArray.length; len > i; i++) args = [
        ''
      ],
      text = textArray[i],
      styleRe.test(text) && (text = text.replace(styleRe, function (t, e) {
        return args.push(e),
        '%c'
      })),
      eval('console.log("' + text + ' ' + args.join('","') + '")')
    }
  } catch (e) {
  }
}(['天天动听,好、好、好、好、好、好音质!go!go!go!',
'加入我们,让音乐动次动次动次动次~',
'请将简历发送至 {color:red}hr@ttpod.com(邮件标题请以“姓名-应聘XX职位-来自console”命名)',
'http://www.ttpod.com/job',
'{font-size:185px;font-family:courier new;width:185px;background:url(http://asset.dongting.com/base/images/ttpod-code-200.png) no-repeat;} ']);