/    Sign up×
Community /Pin to ProfileBookmark

Hello
i want a small help.

i want a function that when you check on a check box another check box appears

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangJan 28.2009 — <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">
function createBox(obj) {
obj.onclick=null;
var elm=null;
var name='box';
var list=document.getElementsByTagName('input');
for(var i=boxes=0; i<list.length; i++) {
if(list[i].getAttribute('type')=='checkbox' && !list[i].getAttribute('name').indexOf('box')) {
boxes++;
}
}

try {
elm=document.createElement('<input type="checkbox" name="'+(name+boxes)+'">');
}
catch(e) {
elm=document.createElement('input');
elm.setAttribute('type', 'checkbox');
elm.name=name+boxes;
}
elm.onclick=function(){createBox(this);};
obj.parentNode.appendChild(elm);
}

window.onload=function() {
document.getElementsByName('box')[0].onclick=function(){createBox(this);};
};
</script>

<style type="text/css">
</style>

</head>
<body>
<form action="#" name="form1">
<div><input type="checkbox" name="box"></div>
</form>
</body>
</html>
×

Success!

Help @michael_george 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.27,
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,
)...