/    Sign up×
Community /Pin to ProfileBookmark

onchange() problem in chrome

hi!
i am having a drop down list which displays the respective form using javascript on selecting the option.Its working fine in Firefox and IE but having trouble in some versions of chrome(latest).i am displaying the code below.

function displayform(item)
{
if(item==”Select :”) {document.getElementById(‘deln’).style.display=”none”;document.getElementById(‘pres’).style.display=”none”;document.getElementById(‘dele’).style.display=”none”;}
if(item==”Delegation”) {document.getElementById(‘deln’).style.display=”block”;document.getElementById(‘pres’).style.display=”none”;document.getElementById(‘dele’).style.display=”none”;}
if(item==”Press”) {document.getElementById(‘deln’).style.display=”none”;document.getElementById(‘pres’).style.display=”block”;document.getElementById(‘dele’).style.display=”none”;}
if(item==”Delegate”) {document.getElementById(‘deln’).style.display=”none”;document.getElementById(‘pres’).style.display=”none”;document.getElementById(‘dele’).style.display=”block”;}
}

<select id=”sf” onChange=”displayform(document.getElementById(‘sf’).value);”>
<option value=”Select :” selected=”selected”>Select :</option>
<option value=”Delegation”>Delegation</option>
<option value=”Press”>Press</option>
<option value=”Delegate”>Delegate</option>
</select>

<form name=”delnform” method=”POST” action=”/2011/MUN/MUN-form.php” id=”deln” style=”display:none;”>
// some inputs
</form>

<form id=”pres” style=”display:none;”>
// some inputs
</form>

<form name=”deleform” method=”POST” action=”/2011/MUN/MUN-form.php” id=”dele” style=”display:none;”>
// some inputs
</form>

only the first form is being displayed on chrome. the remaining two are not being displayed.

thanks in advance.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@FangDec 06.2010 — Works correctly in version 8.0.552.215
Copy linkTweet thisAlerts:
@ravi19_91authorDec 06.2010 — not working in chrome 7.0.517.44
Copy linkTweet thisAlerts:
@KorDec 06.2010 — [B]item[/B] is a reserved JavaScript word. Use other name for your passed argument.
Copy linkTweet thisAlerts:
@ravi19_91authorDec 08.2010 — guys,thankx for ur replies.

i just placed each form in <div> element and itz working fine now!
×

Success!

Help @ravi19_91 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.17,
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,
)...