1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
</style>
<title>Page de test HTML/JS</title>
</head>
<body>
<form name="form1" method="post">
<textarea name="type" rows="5" cols="35" onclick="this.focus();this.select();">
<html><head><title>Help!</title></head><body>Please help!</body></textarea><br>
<input type="checkbox" name="bob" id="bob" value="<p>" onclick="add_sub(this);"><label for="bob"><p></label><br>
<input type="checkbox" name="bob1" id="bob1" value="<span>" onclick="add_sub(this);"><label for="bob1"><span></label><br>
<input type="checkbox" name="bob2" id="bob2" value="<div>" onclick="add_sub(this);" ><label for="bob2"><div></label>
<input type="checkbox" name="bob3" id="bob2" value="super" onclick="add_sub(this);">test
</form>
<script type="text/javascript">
function add_sub(el){
if (el.checked){
el.parentNode.elements['type'].value+='\n'+el.value;
}
else{
var re=new RegExp('(.*)\n'+el.value+'(.*)$');
el.parentNode.elements['type'].value=el.form.elements['type'].value.replace(re,'$1$2');
}
}
</script>
</body>
</html> |