我有一个包含很多组件的网页。有很多按钮,当我单击它们时,它们不会重新加载页面,但是当我单击此代码内的按钮时,

<div style="width:300px; height:250px; float:left; position:absolute; z-index:4">
    <form style="width:100%;">
        <fieldset style="width:250px; height:210px;">
        <legend><b>Authors</b></legend>
        <div id="authors" style="width:250px; height:150px; position:absolute; overflow:scroll">
            <div style="white-space: nowrap;">
                <button class="button removeclick" style="display:block; float:left;"><img src="img/list-remove.png" alt="remove" /></button>
                <button class="button upclick" style="display:block; float:left;"><img src="img/arrow-up.png" alt="arrow-up" /></button>
                <button class="button downclick" style="display:block; float:left;"><img src="img/arrow-down.png" alt="arrow-down" /></button>
                <input  class="resizable" type="text" style="height:29px"/>
            </div>
            <div style="white-space: nowrap;">
                <button class="button removeclick" style="display:block; float:left;"><img src="img/list-remove.png" alt="remove" /></button>
                <button class="button upclick" style="display:block; float:left;"><img src="img/arrow-up.png" alt="arrow-up" /></button>
                <button class="button downclick" style="display:block; float:left;"><img src="img/arrow-down.png" alt="arrow-down" /></button>
                <input  class="resizable" type="text" style="height:29px"/>
            </div>
        </div>
        <div style="position:absolute; top:180px;"><button id="add" class="button" style="display:block; float:right;"><img src="img/add_new.png" alt="add new" /> Add New</button></div>
        </fieldset>
    </form>
    </div>


页面已重新加载,我不知道为什么。我不需要这种行为。

最佳答案

将开始表单标签更改为:

<form style="width:100%;" onsubmit="return false;">

10-06 14:13
查看更多