第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何通過(guò)js如何打開(kāi)input?

如何通過(guò)js如何打開(kāi)input?

牛魔王的故事 2019-03-15 19:15:28
一個(gè)按鈕一個(gè)input<button>Upload</button><input type="file" multiple>點(diǎn)擊input會(huì)彈出上傳文件窗口但是我想要的效果:點(diǎn)擊button會(huì)彈出input上傳窗口,這個(gè)用js該怎么實(shí)現(xiàn)呢?
查看完整描述

7 回答

?
慕容708150

TA貢獻(xiàn)1831條經(jīng)驗(yàn) 獲得超4個(gè)贊

$("button").on("click",function () {

        $("input").click()

    })


查看完整回答
反對(duì) 回復(fù) 2019-04-10
?
夢(mèng)里花落0921

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超6個(gè)贊

input opactity設(shè)置為0后絕對(duì)定為到button上面試試


查看完整回答
反對(duì) 回復(fù) 2019-04-10
?
蝴蝶不菲

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊

定制文件輸入框(input,type,file)樣式

<!DOCTYPE HTML>

<html>

<head>

    <meta charset="utf-8">

    <title>三十客-定制文件輸入框(input,type,file)樣式</title>

    <style>

        .file-wrapper {

            position: relative;

            width: 225px;

        }

        .file-label {

            display: block;

            padding: 14px 20px;

            background: #39D2B4;

            color: #fff;

            font-size: 1em;

            text-align: center;

            transition: all .4s;

            cursor: pointer;

        }

        .input-file {

            position: absolute;

            top: 0; left: 0;

            width: 225px;

            opacity: 0;

            padding: 14px 0;

            cursor: pointer;

        }

        .input-file:hover + .file-label,

        .input-file:focus + .file-label {

            background: #34495E;

            color: #39D2B4;

        }

        form {

            padding: 1rem 0 0 1rem;

        }

    </style>

</head>

<body>

<h2>點(diǎn)擊按鈕查看演示效果</h2>    

<form action="#">

    <div class="file-wrapper">

        <input class="input-file" id="my-file" type="file">

        <label tabindex="0" for="my-file" class="file-label">選擇一個(gè)文件...</label>

    </div>

</form>

</body>

</html>


查看完整回答
反對(duì) 回復(fù) 2019-04-10
?
慕妹3242003

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超6個(gè)贊

button,input 自己通過(guò)id 或者 tag 獲取,大致寫法如下


button.onclick=function(){

    input.onclick();

}


查看完整回答
反對(duì) 回復(fù) 2019-04-10
  • 7 回答
  • 0 關(guān)注
  • 760 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)