Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the interchange between left and right menus in html

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to realize the left and right menu interchange of html, Xiaobian thinks it is quite practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.

function selectOne(){// 1. Get the selected element in Select on the left var leftSelect = document.getElementById("leftSelect"); var options = leftSelect.options; //Find Select on the right var rightSelect = document.getElementById("rightSelect"); //traverse to find the selected option for(var i=0; i

< options.length; i++){ var option1 = options[i]; if(option1.selected){ // 2. 将选中的元素添加到右边的Select中就可以 rightSelect.appendChild(option1); } } } //将左边所有的商品移动到右边 function selectAll(){// 1. 获取左边Select中被选中的元素 var leftSelect = document.getElementById("leftSelect"); var options = leftSelect.options; //找到右侧的Select var rightSelect = document.getElementById("rightSelect"); //遍历找出被选中的option for(var i=options.length - 1; i >

=0; i--){ var option1 = options[i]; rightSelect.appendChild(option1); } } classification name virtools categorized Category Products existing goods >>

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 244

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report