漂亮的?没有。功能性?是的。如果我已经工作了 20 个小时并想快速将某些东西拼凑在一起,我会这样做。与往常一样,不可预见的项目限制可能会使解决方案变得比无用更糟糕。ymmv(第 2 到第 5 个函数未使用,只是模板的一部分)
<!DOCTYPE html>
<html>
<head>
<script>
function byId(e){return document.getElementById(e);}
function newEl(tag){return document.createElement(tag);}
function newTxt(txt){return document.createTextNode(txt);}
function toggleClass(element, newStr)
{
    index=element.className.indexOf(newStr);
    if ( index == -1)
        element.className += ' '+newStr;
    else
    {
        if (index != 0)
            newStr = ' '+newStr;
        element.className = element.className.replace(newStr, '');
    }
}
function forEachNode(nodeList, func)
{
    var i, n = nodeList.length;
    for (i=0; i<n; i++)
    {
        func(nodeList[i], i, nodeList);
    }
}
window.addEventListener('load', mInit, false);
function mInit()
{
    uploadBtn.addEventListener('mouseover', onBtnHover, false);
    uploadBtn.addEventListener('mouseout', onBtnLeave, false);
}
function onBtnHover()
{
    var btn = byId('uploadBtn');
    var xPos, yPos;
    xPos = btn.offsetLeft + btn.offsetWidth + 32;
    yPos = btn.offsetTop;
    var tgt = byId('popup');
    var btnHeight, popupHeight;
    btnHeight = btn.offsetHeight;
    popupHeight = tgt.offsetHeight;
    var vertOffset = (popupHeight-btnHeight) / 2;
    var styleStr = "display: inline-block; visibility: visible;";
    tgt.setAttribute('style', styleStr);
    tgt.style.left = xPos+"px";
    tgt.style.top = yPos-vertOffset+"px";
}
function onBtnLeave()
{
    var tgt = byId('popup');
    tgt.removeAttribute('style');
}
</script>
<style>
.controls
{
    border: solid 2px #aaa;
    padding: 16px;
}
#popup
{
    visibility: hidden;
    z-index: 2;
    position: absolute;
    max-width: 300px;
    border-radius: 4px;
    font-family: verdana;
    background-color: #6495ee;
    color: white;
    padding: 8px;
    font-size: 0.8em;
    box-shadow: 4px 4px 2px rgba(0,0,0,0.3);
}
#popup b
{
    background: white;
    color: black;
    padding: 4px;
    border-radius: 4px;
    border: solid 1px #777;
}
</style>
</head>
<body>
    <div class='controls'>
        <button id='uploadBtn'>Upload<br>file(s)</button>
    </div>
    <div id='popup'>To upload multiple files, <b>Shift</b> + click files in the dialog box..</div>
</body>
</html>