为了把FileUpload的按钮文字改掉,画面上放了一个隐藏的FileUpload,
想点击一下按钮,调用这个FileUpload,在click事件里该如何写呢?

解决方案 »

  1.   

    本帖最后由 net_lover 于 2011-07-05 13:00:48 编辑
      

  2.   

    先把fileupload visible=false ,onclick 事件中,设置visible=true
      

  3.   

    为了把FileUpload的按钮文字改掉
    隐藏fileupload OR CSS
    <html>
    <head>
    <title>test</title>
    <style>
    a.files {
    width:90px;
    height:30px;
    overflow:hidden;
    display:block;
    border:1px solid #BEBEBE;
    background:url(img/fu_btn.gif) left top no-repeat;
    text-decoration:none;
    }
    a.files:hover {
    background-color:#FFFFEE;
    background-position:0 -30px;
    }
    a.files input {
    margin-left:-350px;
    font-size:30px;
    cursor:pointer;
    filter:alpha(opacity=0);
    opacity:0;
    }
    a.files, a.files input {
    outline:none;/*ff*/
    hide-focus:expression(this.hideFocus=true);/*ie*/
    }
    </style>
    <script type="text/javascript">
    window.onload= addfile;
    function addfile(){
    var file = document.createElement("input");
    file.name = "filename";
    file.type = "file"; document.getElementById("idFile").appendChild(file);
    }function hrefclick()
    {
    return false;
    }</script>
    </head>
    <body>
    <a href="javascript:void(0);" class="files" id="idFile"></a>sa
    </body>
    </html>
      

  4.   

    lz 的意思是想把“浏览”改成其他的文字是吧    那你可以不用fileupload这个控件嘛  用一个button代替fileupload button的onclick事件里写
    OpenFileDialog ofd = new OpenFileDialog();
                ofd.ShowDialog();
                MessageBox.Show(ofd.FileName);这样不就行了 button上的文字你想写啥就写啥 或者在html里写这:
     <input type="file" id="file3" style="display:none">
    <input type="button" value="上传(随便你想要写的)" onclick="file3.click()">
      

  5.   


    我也不会,只不过我们得项目是用的
    sliver light ,上传什么的
      

  6.   

    sliver light  类似 Flash 的东西