6

我想在html中使用Dropdown onchange函数来传递值,它在提交按钮中工作正常,但是我想使用Dropdown onchange,请帮忙怎么做?

<form method="post" action=" ">
    <div align="center">
        <select name="value">
            <option value="">Show Value</option><br />
            <option value="2"> 2  </option><br />
            <option value="5"> 5  </option><br />
            <option value="10"> 10 </option><br />
            <option value="20"> 20 </option><br />
        </select>
        <input type="submit" name="submit" value="Submit">
    </div>
</form>
4

1 回答 1

6

你应该像这样添加onChange<select>元素中

<form method="post" action=" ">
    <div align="center">
        <select name="value" onChange="this.form.submit()">
            <option value="">Show Value</option><br />
            <option value="2"> 2  </option><br />
            <option value="5"> 5  </option><br />
            <option value="10"> 10 </option><br />
            <option value="20"> 20 </option><br />
        </select>
        <input type="submit" name="submit" value="Submit">
    </div>
</form>
于 2012-05-03T20:57:34.343 回答