<div class="codetitle"> <span><a style="CURSOR: pointer" data="73588" class="copybut" id="copybut73588" onclick="doCopy('code73588')"><u>复制代码</u></a></span>代码如下:</div> <div class="codebody" id="code73588"> <br>window["MzBrowser"] ={}; <br>(function() <br>{ <br>if(MzBrowser.platform) return; <br>var ua = window.navigator.userAgent; <br>MzBrowser.platform = window.navigator.platform; <br> MzBrowser.firefox = ua.indexOf("Firefox") > 0; <br>MzBrowser.opera = typeof(window.opera) == "オブジェクト"; <br>MzBrowser.opera && ua.indexOf ("MSIE") > 0; <br>MzBrowser.mozilla = window.navigator.product == "Gecko"; <br>MzBrowser.netscape = window.navigator.vendor == "Netscape"; safari = ua.indexOf("Safari") > <br>if(MzBrowser.firefox) var re = /Firefox(s|/)(d (.d )?)/; MzBrowser.ie) var re = /MSIE( )(d (.d )?)/; <br>else if(MzBrowser.opera) var re = /Opera(s|/)(d (.d )?)/ ; <br>else if(MzBrowser.netscape) var re = /Netscape(s|/)(d (.d )?)/; <br>else if(MzBrowser.safari) var re = /Version(/)( d (.d )?)/; <br>else if(MzBrowser.mozilla) var re = /rv(:)(d (.d )?)/; <br>if("未定義" != typeof(re) ) && re.test(ua)) <br>MzBrowser.version = parseFloat(RegExp.$2) <br>} <br>); <br>関数 upLoadKey(e, object) <br>{ <br>if((document.all) ? true : false) <br>{ <br>window.event.keyCode == 9 ? (window.event.returnValue = true) : (window.event.returnValue = false); <br>} <br>else <br>{ <br>if(object.value == "" && typeof e.that == "number")e.preventDefault(); <br>if(object.value != "") object.blur(); <br>} <br>} <br>関数バージョン(オブジェクト) <br>{ <br>if(MzBrowser.firefox && MzBrowser.version == 2)object.blur(); <br>} <br>function clearValue(id) <br>{ <br>var up = (typeof id == "string") ? document.getElementById(id) : id; <br>if (typeof up != "object") は null を返します。 <br>var tt = document.createElement("span"); <br>tt.id = "__tt__"; <br>up.parentNode.insertBefore(tt, up); <br>var tf = document.createElement("form"); <br>tf.appendChild(up); <br>document.getElementsByTagName("body")[0].appendChild(tf); <br>tf.reset(); <br>tt.parentNode.insertBefore(up, tt); <br>tt.parentNode.removeChild(tt); <br>tt = null; <br>tf.parentNode.removeChild(tf); <br>} <br><br><br>// 页面代仔 </div> <br><br><div class="codetitle"><span>复制代仔<a style="CURSOR: pointer" data="65302" class="copybut" id="copybut65302" onclick="doCopy('code65302')"><u></u> 代仔以下:</a></span></div><html> <div class="codebody" id="code65302"> <br><スクリプト言語="javascript" src="upLoad.js"></script> <br></head> <br> <br><input name="textfield3" type="file" class="input" id="textfield3" size="30" value="" ondrag="return false;" oncut="偽を返す;" onkeydown="upLoadKey(event,this);" onpaste="偽を返す;" onmousedown="document.oncontextmenu = function() { return false;}" onmouseout="document.oncontextmenu = function() { return true;};version(this);" tabIndex = -1/> <input type="button" id="clear" value="清空" onclick="clearValue('textfield3');"/> <br></body> <br></html> <br><br> </div>