随笔分类 - js
摘要:<input id="btnPrint" type="button" value="打印" onclick="javascript:window.print();" /> <input id="btnPrint" type="button" value="打印预览" onclick=preview(1) /> <style type="text/css" media=print> .noprint{d
阅读全文
摘要://去左空格;functionltrim(s){returns.replace(/(^\s*)/g,"");}//去右空格;functionrtrim(s){returns.replace(/(\s*$)/g,"");}//去左右空格;functiontrim(s){//returns.replace(/(^\s*)|(\s*$)/g,"");returnrtrim(ltrim(s));}
阅读全文
摘要:js Date-摘自互联网Date 对象用于处理日期和时间。创建 Date 对象的语法:var myDate=new Date()Date 对象会自动把当前日期和时间保存为其初始值。参数形式有以下5种: new Date("month dd,yyyy hh:mm:ss"); newDate("month dd,yyyy"); newDate(yyyy,mth,dd,hh,mm,ss); new Date(yyyy,mth,dd); new Date(ms);注意最后一种形式,参数表示的是需要创建的时间和GMT时间1970年1月1日之间相差的毫秒数。各种函
阅读全文
摘要:由于<input type="file">的value属性石只读的,所以要取消选择只能通过其他途径,此处有2种方法JS代码 <input type="file" id="fileupload" name="file" /> 第一种: (display:none时不能用) var obj = document.getElementById('fileupload') ; obj.select(); document.execCommand("delete")
阅读全文
摘要:代码如下:<input type=button value=刷新 onclick="history.go(0)"> 代码如下:<input type=button value=刷新 onclick="location.reload()"> 代码如下:<input type=button value=刷新 onclick="location=location">代码如下:<input type=button value=刷新 onclick="window.navigate(locat
阅读全文
浙公网安备 33010602011771号