要实现单行变化,如何修改,求JS高手来解决
时间:2010-05-06
来源:互联网
我想实现多行点击转行,求JS高手指点下
<!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="led" /> <meta name="keywords" content="led" /> <meta name="description" content="led" /> <head> <title>点击按钮后,文本框变为文本框</title> <script type="text/javascript"> function showSelect(){ var _t = document.getElementById('t'); var _s = document.getElementById('sel'); if( _t.style.display == ''){ _t.style.display = 'none'; } else{ _t.style.display = ''; } if ( _s.style.display == 'none' ){ _s.style.display = ''; } else{ _s.style.display = 'none'; } } </script> </head> <body> 第二行点击没效果 <ul> <li><div id="sel" >自定义分类名称<input type="submit" name="Submit" onclick="showSelect();" value="修改名称" /></div> <div id="t" style="display:none;"><input type="text" name="t" value="自定义分类名称1"> <input type="submit" name="Submit" onclick="showSelect();" value="确定" /><input type="submit" name="Submit" value="取消" /> </li> <li><div id="sel" >自定义分类名称<input type="submit" name="Submit" onclick="showSelect();" value="修改名称" /></div> <div id="t" style="display:none;"><input type="text" name="t" value="自定义分类名称2"> <input type="submit" name="Submit" onclick="showSelect();" value="确定" /><input type="submit" name="Submit" value="取消" /> </li> <li><div id="sel" >自定义分类名称<input type="submit" name="Submit" onclick="showSelect();" value="修改名称" /></div> <div id="t" style="display:none;"><input type="text" name="t" value="自定义分类名称3"> <input type="submit" name="Submit" onclick="showSelect();" value="确定" /><input type="submit" name="Submit" value="取消" /> </li> </ul> </div> </body> </html>
提示:您可以先修改部分代码再运行
[ 本帖最后由 zhangbo1116 于 2010-5-6 15:14 编辑 ] 提示:您可以先修改部分代码再运行
作者: zhangbo1116 发布时间: 2010-05-06
id="sel" id="t" id重复了
作者: 63650539 发布时间: 2010-05-06
你这样的写法 JS只会获取第一个
作者: 63650539 发布时间: 2010-05-06
<!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="led" /> <meta name="keywords" content="led" /> <meta name="description" content="led" /> <head> <title>点击按钮后,文本框变为文本框</title> <script type="text/javascript"> function showSelect(n){ var _t = document.getElementById('t'+n); var _s = document.getElementById('sel'+n); if( _t.style.display == ''){ _t.style.display = 'none'; } else{ _t.style.display = ''; } if ( _s.style.display == 'none' ){ _s.style.display = ''; } else{ _s.style.display = 'none'; } } </script> </head> <body> 第二行点击没效果 <ul> <li><div id="sel1" >自定义分类名称<input type="submit" name="Submit" onclick="showSelect(1);" value="修改名称" /></div> <div id="t1" style="display:none;"><input type="text" name="t" value="自定义分类名称1"> <input type="submit" name="Submit" onclick="showSelect(1);" value="确定" /><input type="submit" name="Submit" value="取消" /> </li> <li><div id="sel2" >自定义分类名称<input type="submit" name="Submit" onclick="showSelect(2);" value="修改名称" /></div> <div id="t2" style="display:none;"><input type="text" name="t" value="自定义分类名称2"> <input type="submit" name="Submit" onclick="showSelect(2);" value="确定" /><input type="submit" name="Submit" value="取消" /> </li> <li><div id="sel3" >自定义分类名称<input type="submit" name="Submit" onclick="showSelect(3);" value="修改名称" /></div> <div id="t3" style="display:none;"><input type="text" name="t" value="自定义分类名称3"> <input type="submit" name="Submit" onclick="showSelect(3);" value="确定" /><input type="submit" name="Submit" value="取消" /> </li> </ul> </div> </body> </html>
提示:您可以先修改部分代码再运行
提示:您可以先修改部分代码再运行
作者: 4321285 发布时间: 2010-05-06
非常感谢
作者: zhangbo1116 发布时间: 2010-05-07
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28