常见JS demo 亲测
<script type=text/javascript src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" /></script> //google jquery onclick="event.returnValue=false;" //禁用checkbox 火狐无效 encodeURIComponent() JS中文URL编码 utf8 function addFav(t) {document.write('<a href="'+window.location.href+'" title="'+document.title+'" rel="sidebar" onclick="window.external.addFavorite(this.href, this.title);return false;">'+t+'</a>');} //收藏 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script language="JavaScript" type="text/javascript" src="/templets/default/bcc/js/jquery.countdown.min.js"></script> <script> var liftoffTime456 = new Date("2011/04/20 11:14:56"); var serverdate = new Date("2011/04/21 11:14:56"); var localdate = new Date(); var jtime = localdate - serverdate; // liftoffTime456.setUTCSeconds(liftoffTime456.getUTCSeconds() + Math.round(jtime / 1000)); alert(jtime); $(function() { $('#aa').countdown({ alwaysExpire: true, layout: '{hnn}{sep}{mnn}{sep}{snn}', until: liftoffTime456, format: 'HMS', timezone: +8, onExpiry: function() { liftOff('456') } }); }); </script> <span id="aa"></span> //js 倒计时 $(function(){ $('#leftmenu a').click(function(){ $('#leftmenu a').each(function() { $(this).removeClass('tabon'); }); $(this).addClass('tabon'); }); }) //li选择器 onclick="document.forms['alipaysubmit'].submit();" //图片提交 function ShowPic(file,img,imgname) { var fileobj = document.getElementById(file); var imgobj = document.getElementById(img); fileobj.value = imgname.value; if(imgname.files){ if(imgobj)imgobj.src = imgname.files[0].getAsDataURL(); //火狐 } else { if(imgobj){ imgobj.style.display = "none"; //IE document.getElementById(img+"_div").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgname.value; document.getElementById(img+"_div").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").sizingMethod='scale'; } } } ===实例=== <div id="picnamediv_div" style="FILTER:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);width:160px; height:120px; display:block; overflow:hidden; display:inline; float:left;"> <?php echo eip_image(eip_href_link('upload/none1.png'),'','160','120','id="picnamediv" name="picnamediv"'); ?> </div> //上传图片预览 "星期" + "日一二三四五六".split("")[new Date("2011/2/2").getDay()] //JS判断时间 <script language="javascript" type="text/javascript"> function DrawImage(ImgD,FitWidth,FitHeight) { var image=new Image(); image.src="http://java.ccidnet.com/art/3539/20080625/ImgD.src;" if(image.width>0 && image.height>0) { if(image.width/image.height>= FitWidth/FitHeight) { if(image.width>FitWidth) { ImgD.width=FitWidth; ImgD.height=(image.height*FitWidth)/image.width; } else { ImgD.width=image.width; ImgD.height=image.height; } } else { if(image.height>FitHeight) { ImgD.height=FitHeight; ImgD.width=(image.width*FitHeight)/image.height; } else { ImgD.width=image.width; ImgD.height=image.height; } } } } <script> //缩略图 <script type=text/javascript src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" /></script> <script> $(function(){ $("<div>",{ id: 'test', text: 'this is a test', "class": "test", click: function(){ $(this).toggleClass('test'); } }).appendTo("body"); }) </script> //自动生成 <iframe src="" style="width:800px;height:536px;top:0px;left:0px;position:absolute;visibility:inherit;z-index:-1;" frameborder=0>
</iframe> 遮挡SELECT 只要在层里面加上下面代码就可以了~ <iframe src="" style="width:800px;height:536px;top:0px;left:0px;position:absolute;visibility:inherit;z-index:-1;" frameborder=0>
</iframe>
生命只有一次。