JS method to change the option attribute in select_javascript skills
The example in this article describes the method of changing the option attribute in select using JS. Share it with everyone for your reference. The details are as follows:
Help a friend solve a small problem. The requirement is to change the text value displayed in the selected tab, and the new value is stored in a certain text box
Initial window:
<html> <head> <title>原窗口</title> <script> var parentValue=""; //全局变量,用于保存点击详情时select中指定opeion的值 function detail() { var select=document.getElementById('SHGX'); //获得select对象 parentValue=select.options[select.selectedIndex].text; window.open('详情窗口.html') } function updateSelect(childValue) { var select=document.getElementById('SHGX'); for(var i=0;i<select.length;i++) { if(select.options[i].text==parentValue) select.options[i].text=childValue; } } </script> </head> <body> <select id='SHGX'> <option value='111' title='夫'>夫</option> <option value='112' title='妻'>妻</option> <option value='120' title='子'>子</option> <option value='121' title='独生子'>独生子</option> <option value='122' title='继子'>继子</option> <option value='128' title='女婿'>女婿</option> </select> <button onclick="detail(); ">详情</button> </body> </html>
Details window:
<html> <head> <title>详情窗口</title> <script> function modify() { var childValue=document.getElementById('text_01').value; opener.updateSelect(childValue); //调用父窗口的函数 } </script> </head> <body> <input id="text_01" type="text" value=""/> <button onclick="modify();">修改</button> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Many users like to download various wallpapers and videos on WallpaperEngine. Over time, they will find that more and more wallpapers are downloaded, resulting in insufficient hard disk space. At this time, the storage location of WallpaperEngine can be changed to reduce the space occupied. So let’s take a look at how to change the save path for wallpaperengine. Step 1: Click Settings under steam in the upper left corner to open the following interface. Step 2: Click Download to find the "Steam Library Folder" under the content library, and click Open above. Step 3: Click Add Library Folder, select the path you want to change to, and after adding it, right-click on the default column.

The default desktop icon font of win7 is generally white. If we use a white desktop background, the desktop icon text may not be visible. At this time, we can customize the desktop font color through the advanced appearance settings in the personalization settings. The following is Let’s take a look together. Tutorial on changing the font color of win7 desktop icons 1. Right-click a blank space on the desktop and open the "Personalization" settings. 2. Under Theme, we can directly select the desired theme to change the font color of desktop icons. 3. If you are not satisfied with these themes, you can also turn on the "Window Color" as shown in the picture. 4. Click "Advanced Appearance Settings" below 5. Change the "Project" at the icon location to "Desktop" 6. Then you can change various attributes such as font color and size in the red box

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

Teach you step by step how to change the background color in Eclipse, specific code examples are required Eclipse is a very popular integrated development environment (IDE) that is often used to write and debug Java projects. By default, the background color of Eclipse is white, but some users may wish to change the background color to suit their preference or to reduce eye strain. This article will teach you step by step how to change the background color in Eclipse and provide specific code examples. Step 1: Open Eclipse First

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3

When the game you want to buy is not available, you can purchase it by changing the region. Do any players know how to change the region settings in the Xbox store? So let’s take a look at the introduction to changing the region settings in the Xbox store! Xbox store region settings: 1. Open windows settings - select time and language. 2. Select the region - the default should be China - select other countries and regions. 3. Select other countries and regions - enter the store - the store prompts you to refresh the content.

Properly setting the startup sequence of win7 can make our computer boot faster, but many friends don’t know how to change the startup sequence. In fact, we can change it in the registry editor. Let’s take a look at it with the editor. A specific method. Tutorial on changing the win7 startup sequence 1. Search for "Run" in the lower left corner. 2. Open the "Run" program. 3. Enter “regedit” and press Enter to confirm. 4. Find the following path "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServiceGroupOrder" and right-click to modify the icon "list" file. 5. The position shown in the picture is from top to bottom.
