Home >Web Front-end >JS Tutorial >js value transfer judgment_form effects

js value transfer judgment_form effects

WBOY
WBOYOriginal
2016-05-16 19:24:421127browse

How to make the value passed from other pages equal to a certain one in JS, then the selected one will be selected by default?

Copy code The code is as follows:

var ops = drop-down menu.childNodes;
for(var i=0;i{
if(pass it over The value == ops[i].innerText) //It can also be ops[i].value, depending on the situation
{
        ops[i].selected = "selected";
}
}

A simple judgment will suffice, I don’t know where the poster is in trouble
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn