Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Есть <input type=chekboc>
и <texatarea></textarea>
Нужно чтобы если в текстареа появляется буква то автоматом выделялось чекбокс, как можно реолизовать на java?
<input type="text" />
<input type="checkbox" />
<script>
checkbox=document.getElementsByTagName('input')[1]
input=document.getElementsByTagName('input')[0]
function handler(){
if(input.value.length>0){
checkbox.checked=true
}else{
checkbox.checked=false
}
}
if(input.addEventListener){
input.addEventListener('keyup',handler,false)
}
else{
input.attachEvent('onkeyup',handler)
}
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<!--[if lt IE 9]><script src="http://ie7-js.googlecode.com/svn/trunk/lib/IE9.js"></script><![endif]-->
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" type="text/css" href="jquery.cleditor.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="jquery.cleditor.min.js"></script>
<script type="text/javascript">
$(document).ready(function () { $("#input").cleditor(); });
</script>
</head>
<body>
<input type="checkbox" id="iamcheckbox">
<textarea rows="4" cols="100%" id="input" onfocus="onFocusTextArea();" onblur="onBlurTextArea();" ></textarea>
<script type="text/javascript">
function onFocusTextArea(){
document.getElementById("iamcheckbox").checked = true;
}
function onBlurTextArea(){
if(document.getElementById("input5").value==""){
document.getElementById("iamcheckbox").checked = false;
}
}
</script>
</body>
</html>