用js写一段代码,不用标签 一个select框,旁边一个按钮,点击一下按钮,下面出现三个文本框1、2、3,假如点击第一个文本框,则把文本框里的内容显示在select框中 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jquery写的,希望对楼主有帮助。<html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script></head><body> <select id="Select1"> <option></option> </select> <input type="button" value="按钮" /> <div id="txt" style="display: none;"> <input type="text" value="1" /> <br /> <input type="text" value="2" /> <br /> <input type="text" value="3" /> </div></body></html><script> $(function () { $("input[type='button']").bind("click", function () { //层显示 $("#txt").show(); }); $("input[type='text']").bind("click", function () { $("#Select1").empty(); $("#Select1").append(" <option value='" + $(this).val() + "'>" + $(this).val() + "</option>"); }); });</script> <select id='s'></select><input id='t' onclick='fun1(this);'></input>function fun1(obj){ var ss=document.getElementById('s'); var opt = document.createElement("<option>"); opt.text = this.value; opt.name = this.id; ss.options.add(opt);}大概是这个意思 ,具体什么样还要看你的需求 要求用js写已经写了一部分var oSel = document.createElement("select");oSel.multiple = true;oSel.size = 3;oSel.style.width = "150px";document.body.appendChild(oSel);var button=document.createElement("input");button.type="button";button.value="Add";button.onclick=function(){ add();}document.body.appendChild(button);function add(){ var text1=document.createElement("input"); var text2=document.createElement("input"); var text3=document.createElement("input"); text1.value = "tt"; text2.value="tingting"; text3.value="紫蔓" document.body.appendChild(text1); document.body.appendChild(text2); document.body.appendChild(text3); //text1.click = aa(text1.value);}还有一步就是点击任一个文本框,然后把文本框里的值显示在那个大的文本框里,帮忙! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD><BODY><script type='text/javascript'>var oSel = document.createElement("select");oSel.multiple = true;oSel.size = 3;oSel.style.width = "150px";document.body.appendChild(oSel);var button=document.createElement("input");button.type="button";button.value="Add";button.onclick=function(){ add();}document.body.appendChild(button);function add(){ var text1=document.createElement("input"); var text2=document.createElement("input"); var text3=document.createElement("input"); text1.value = "tt"; text2.value="tingting"; text3.value="紫蔓" document.body.appendChild(text1); document.body.appendChild(text2); document.body.appendChild(text3); text1.onclick = text2.onclick = text3.onclick = function(){ var option = document.createElement('option'); option.innerText = this.value; oSel.appendChild(option); }}</script></BODY></HTML> 关于IE7的CSS问题 二级联动的问题 如何用正则表达式解析标签? 使用jquery点击某一列,对那一列以数字大小进行排序 javascript 计算天数问题,简单!!急!!!! 冰天雪地裸求 我的javascript不运行怎末办? 如何将一个字符传如"'aa','bb'"做为参数传递. 在线等.... 提交表单时如何取Iframe的值? SQL语句执行控制问题 使用三大框架实现页面的修改 Ext 中ComboBox的设定初始值的问题 javascript 响应 ActiveX里的事件
<head>
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
</head>
<body>
<select id="Select1">
<option></option>
</select>
<input type="button" value="按钮" />
<div id="txt" style="display: none;">
<input type="text" value="1" />
<br />
<input type="text" value="2" />
<br />
<input type="text" value="3" />
</div>
</body>
</html>
<script>
$(function () {
$("input[type='button']").bind("click", function () {
//层显示
$("#txt").show();
});
$("input[type='text']").bind("click", function () {
$("#Select1").empty();
$("#Select1").append(" <option value='" + $(this).val() + "'>" + $(this).val() + "</option>");
});
});
</script>
<input id='t' onclick='fun1(this);'></input>
function fun1(obj){
var ss=document.getElementById('s');
var opt = document.createElement("<option>");
opt.text = this.value;
opt.name = this.id;
ss.options.add(opt);
}
大概是这个意思 ,具体什么样还要看你的需求
已经写了一部分
var oSel = document.createElement("select");
oSel.multiple = true;
oSel.size = 3;
oSel.style.width = "150px";
document.body.appendChild(oSel);var button=document.createElement("input");
button.type="button";
button.value="Add";
button.onclick=function(){
add();
}
document.body.appendChild(button);function add(){
var text1=document.createElement("input");
var text2=document.createElement("input");
var text3=document.createElement("input");
text1.value = "tt";
text2.value="tingting";
text3.value="紫蔓"
document.body.appendChild(text1);
document.body.appendChild(text2);
document.body.appendChild(text3);
//text1.click = aa(text1.value);
}还有一步就是点击任一个文本框,然后把文本框里的值显示在那个大的文本框里,帮忙!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT=""> </HEAD><BODY>
<script type='text/javascript'>
var oSel = document.createElement("select");
oSel.multiple = true;
oSel.size = 3;
oSel.style.width = "150px";
document.body.appendChild(oSel);var button=document.createElement("input");
button.type="button";
button.value="Add";
button.onclick=function(){
add();
}
document.body.appendChild(button);function add(){
var text1=document.createElement("input");
var text2=document.createElement("input");
var text3=document.createElement("input");
text1.value = "tt";
text2.value="tingting";
text3.value="紫蔓"
document.body.appendChild(text1);
document.body.appendChild(text2);
document.body.appendChild(text3);
text1.onclick = text2.onclick = text3.onclick = function(){
var option = document.createElement('option');
option.innerText = this.value;
oSel.appendChild(option);
}
}
</script>
</BODY>
</HTML>