/    Sign up×
Community /Pin to ProfileBookmark

regarding combo box index

i have a text and i have to verify the combo box values ,and if it is exists then we have to show tht as a selected item
example
have a string “red”
i have to verify colors combo for red
if it is found i have to show tht was as a selected item in combo box

how can i do this?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsNov 28.2008 — [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/

function Sel(ip,sel){
sel=document.getElementById(sel);
sel.selectedIndex=0;
var opts=sel.options;
for (var zxc0=0;zxc0<opts.length;zxc0++){
if (opts[zxc0].value==ip.value){
sel.selectedIndex=zxc0;
break;
}
}

}
/*]]>*/
</script></head>

<body>
<input name="" onblur="Sel(this,'tst');"/>
<select id="tst" >
<option value="" >Colors</option>
<option value="red" >red</option>
<option value="green" >green</option>
<option value="blue" >blue</option>
</select>
</body>

</html>[/CODE]
×

Success!

Help @arumilli spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...