原来FireFox也有这些安全性的问题,怎么没人搞它去?

解决方案 »

  1.   

    图片的可以搞定,我在网上收藏的代码如下:<script language='javascript'>
    var img=null;
    function s()
    {
    if(img)img.removeNode(true);
    img=document.createElement("img");
    img.style.position="absolute";
    img.style.visibility="hidden";
    img.attachEvent("onreadystatechange",orsc);
    img.attachEvent("onerror",oe);
    document.body.insertAdjacentElement("beforeend",img);
    img.src=inp.value;
    }
    function oe()
    {
    alert("cant load img");
    }
    function orsc()
    {
    if(img.readyState!="complete")return false;
    alert("图片大小:"+img.offsetWidth+"X"+img.offsetHeight);
    alert("图片尺寸:"+img.fileSize);
    alert("图片格式:"+ img.src.replace(/.+(\.\w+)/, "$1")); //*&**&*
    }</script>
    <input id=inp type="file">
    <br/>
    <input type='button' onclick='s();' value='Test'>
      

  2.   

    图片文件都不用提交到服务器,在客户端就能判断,如上
    如果是其它文件,可以将<file> 放到一个Iframe中试试,可能能实现你的要求。
      

  3.   

    IE也可以啊:<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Test</title>
    </head><body>
    form1
    <form method=get action="http://www.csdn.net" >
    <input type=file name=f1>
    <input type=submit value=submit1 >                         
    </form>
    <hr>
    form2
    <form >
    <input type=button value="moveFileToThisForm" onclick="this.form.appendChild(document.all.f1);">
    <input type=submit value=submit2 >  
    </form>
    </body></html>
      

  4.   

    谢谢“JK_10000(JK)”的努力,但我要的不是move,而是copy一个过来,原form内的元素保持不变。
      

  5.   

    copy是不可能的,可以试下先移过去,再移回来。
    不一定行,试下啊。