请教这样的效果如何实现? 点击左边的checkbox,右边有相应的文字出现。现在急需如何实现?谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 onclik事件 改变右边的文字就是 funcion changetext(tt){ var aa =document.getElementById("aa");if(tt == "a") aa.innerHTML = "aa";} function changeText(){ var cb = document.getElementById("checkbox1"); if(cb!==null && cb.checked) { document.getElementById("textbox1").innerText="asdf"; }} <input type=checkbox onclick='document.getElementById("inp").value=this.checked?this.value:"";)' value='safd'><input type=input id='inp' value='safd'> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <style type="text/css"> div { width: 500px; height: 24px; } </style> <script type="text/javascript"> function getValue() { var cbs = document.getElementsByName("cb"); var txts = document.getElementsByName("txt"); for (var i = 0; i < cbs.length; i++) { if (cbs[i].checked == true) { txts[i].value = cbs[i].value; } } } </script></head><body> <div> <input type="checkbox" name="cb" value="Roses are red" onclick="getValue()" />Roses are red <input style="float: right" type="text" size="10" name="txt" /></div> <div> <input type="checkbox" name="cb" value="If at first you don't succeed" onclick="getValue()" />If at first you don't succeed <input style="float: right" type="text" size="10" name="txt" /></div> <div> <input type="checkbox" name="cb" value="Four score" onclick="getValue()" />Four score <input style="float: right" type="text" size="10" name="txt" /></div></body></html> if判断后面加 else if (cbs[i].checked == false) { txts[i].value = ""; }取消选择时可以消掉文本的值; jquery能不能在chrome自带的开发工具测试 【菜】jsp如何处理json格式数据 求助:移动DIV的时候背景图片问题 十万火急:如何通过Javascript读取不在同一个服务器上的网页 求高手解决!<DIV>坐标问题 .js文件我怎么样才能从别人网站上下载下来? js问题,求帮助 文本框不能为空的验证 frame 中怎么切换其他html链接 文本型如何转换成数字型? 用Javascript进行计算,屏幕僵住,有办法解决吗? 关于页面数据转移的问题
funcion changetext(tt)
{
var aa =document.getElementById("aa");
if(tt == "a")
aa.innerHTML = "aa";
}
{
var cb = document.getElementById("checkbox1");
if(cb!==null && cb.checked)
{
document.getElementById("textbox1").innerText="asdf";
}
}
<input type=input id='inp' value='safd'>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
div { width: 500px; height: 24px; }
</style> <script type="text/javascript">
function getValue() {
var cbs = document.getElementsByName("cb");
var txts = document.getElementsByName("txt");
for (var i = 0; i < cbs.length; i++) {
if (cbs[i].checked == true) {
txts[i].value = cbs[i].value;
}
}
}
</script></head>
<body>
<div>
<input type="checkbox" name="cb" value="Roses are red" onclick="getValue()" />Roses
are red
<input style="float: right" type="text" size="10" name="txt" /></div>
<div>
<input type="checkbox" name="cb" value="If at first you don't succeed" onclick="getValue()" />If at first
you don't succeed
<input style="float: right" type="text" size="10" name="txt" /></div>
<div>
<input type="checkbox" name="cb" value="Four score" onclick="getValue()" />Four score
<input style="float: right" type="text" size="10" name="txt" /></div>
</body>
</html>
txts[i].value = "";
}取消选择时可以消掉文本的值;