私は次のhtmlを持っています。
<ul>
<li>
<label id="firstswitch-lbl" class="hasTip">My First Selector:</label>
<select id="first_switch" class="switch">
<option value="0">Enable</option>
<option selected="selected" value="1">Disable</option>
</select>
</li>
<li>
<label id="first_title-lbl" class="hasTip">First Select:</label>
<input id="first_title" class="text" type="text" size="3" value="50">
</li>
<li>
<label id="secondswitch-lbl" class="hasTip">My Second Selector </label>
<select id="second_switch" class="switch">
<option value="0">Enable</option>
<option selected="selected" value="1">Disable</option>
</select>
</li>
<li>
<label id="second_title-lbl" class="hasTip">Second Select:</label>
<input id="second_title" class="text" type="text" size="3" value="100">
</li>
<li>
<label id="thirdswitch-lbl" class="hasTip">My Third Selector </label>
<select id="third_switch" class="switch">
<option value="0">Enable</option>
<option selected="selected" value="1">Disable</option>
</select>
</li>
<li>
<label id="third_title-lbl" class="hasTip">Third Select:</label>
<input id="third_title" class="text" type="text" size="3" value="200">
</li>
<li>
<label id="fourthswitch-lbl" class="hasTip">My Fourth Selector </label>
<select id="fourth_switch" class="switch">
<option value="0">Enable</option>
<option selected="selected" value="1">Disable</option>
</select>
</li>
<li>
<label id="fourth_title-lbl" class="hasTip">Fourth Select:</label>
<input id="fourth_title" class="text" type="text" size="3" value="200">
</li>
そして、正常に動作するmootools javascriptに従ってください。
document.id('first_switch').inject(document.id('first_switch').getParent().getNext(), 'bottom');
document.id('first_title').getParent().getPrevious().dispose();
document.id('second_switch').inject(document.id('second_switch').getParent().getNext(), 'bottom');
document.id('second_title').getParent().getPrevious().dispose();
ただし、約20行以上の同様の行があるため、同じコードを繰り返す回数を減らそうとしています.
Selector の横に値ボックスを追加して、2 行ではなく同じ行に配置しようとしています。どんな助けでも大歓迎です。前もって感謝します。
以下は、フィドルのサンプルコードへのリンクです