/    Sign up×
Community /Pin to ProfileBookmark

what is wrong wiht this script pls

What is wrong with this script pls ? it doesnt work…
Thanks

<html>

<head>
<title></title>
</head>
<Script type=”text/javascript”>
function visibleToggle(elment,state) {
alert(state);
document.getElementById(elment).style.display = state;
}

</Script>
<body>
<form>
<input type=”checkbox” name=”option1″ value=”name” onClick=”visibleToggle(‘toggle’,’none’)”>

<div id=”toggle” style=”display: none;” >
<tr>
<td>
First name:
</td>
<td>
<input type=”text” name=”firstname”>
</td>
</tr>
</div>
<tr>
<td>
Last name:
</td>
<td>
<input type=”text” name=”lastname”>
</td>
</tr>

</form>
</body>

</html>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@felgallApr 28.2006 — It is working but since the script is setting display to none and it already is none there is no visible change on the screen. Try changing:

onClick="visibleToggle('toggle','none')"

to

onClick="visibleToggle('toggle','block')"

and you will see the difference. If you really want the field to always change state when the checkbox is clicked then you need to change the function so that is swaps the state rather than setting it.
×

Success!

Help @alidar777 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.18,
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,
)...