function copy(inElement) {
  if (inElement.createTextRange) {
    var range = inElement.createTextRange();
    if (range)
      range.execCommand('Copy');
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
  var info = new Element('span').update(' +已经复制代码到剪贴板');
  info.setStyle({color:'#3E8F49',fontSize:'12px'});
  Element.insert(inElement, {after: info});
}

window.onload = function() {
    //遍历文档中的图片
    for (var index = 0; index < document.images.length; index++) {
        //定义要限制的图片宽高
        var widthRestriction = 120;
        var heightRestriction = 120;
        //开始调整尺寸
        if (document.images[index].width > widthRestriction) {
            document.images[index].width = widthRestriction;
        } else if (document.images[index].height > heightRestriction) {
             document.images[index].height = heightRestriction;
        }
    }
}