我的页面上有这样一个元素<div>
产品类别:<input type="text" name="productType" /><br />
产品图片:<input type="text" name="productImg" /><br />
产品名称:<input type="text" name="productName" /><br />
产品说明:<textarea rows="10" cols="50" name="productIntroduce"></textarea>
</div>有一个按钮,点击它的时候调用JavaScript,创建一个层,层里包含上述代码所示的所有表单元素。该如何实现呢?
产品类别:<input type="text" name="productType" /><br />
产品图片:<input type="text" name="productImg" /><br />
产品名称:<input type="text" name="productName" /><br />
产品说明:<textarea rows="10" cols="50" name="productIntroduce"></textarea>
</div>有一个按钮,点击它的时候调用JavaScript,创建一个层,层里包含上述代码所示的所有表单元素。该如何实现呢?
解决方案 »
- jsp向servlet跳转是404错误
- tomcat启动报错Perhaps it exists but certain dependencies are not available, 求大神
- hibernate见表,插入不进去数据
- 菜鸟问题,如何用webwork标签获得List的方法
- 求助openfire
- 怎么消除jsp中get方法传递中文参数出现乱码的情况????
- (急、急、急)另存EXCEL response.setHeader("Content-disposition","
- 用JAVA访问SQL SERVER需要在JDK中加什么东西吗?若不需要为什么下面的程序访问不了数据库?
- 关于J2EE、Jsp、EJB的开发
- 求最简单的MVC的例子!
- tomcat记录的日志文件里边有很多unkown source 的提示,如果让其提示出代码行数?
- 关于servlet编译
<div id="productDiv" style="display: none;">
产品类别:<input type="text" name="productType" /><br />
产品图片:<input type="text" name="productImg" /><br />
产品名称:<input type="text" name="productName" /><br />
产品说明:<textarea rows="10" cols="50" name="productIntroduce"></textarea>
</div>
<input type="button" value="查看" onClick="showProductDiv();" >
<script type="text/JavaScript">
function showProductDiv(){
document.getElementById("productDiv").style.display = '';
}
</script>
{
html += '<div>
html += ' 产品类别:<input type="text" name="productType" /><br />'
html += ' 产品图片:<input type="text" name="productImg" /><br /> '
html += ' 产品名称:<input type="text" name="productName" /><br />'
html += ' 产品说明:<textarea rows="10" cols="50" '
html += ' name="productIntroduce"></textarea>'
html += '</div>'
$("").innerHTML = html;
}
我觉得 利用 层的可见性那个比较有意思。简单楼上的这个方案性能最低! +=“” 的操作没事不要做这么多!下面的 楼主可参考下!..
<html><script>
function create(){
var div = document.getElementById("div");
var array = new Array;
array.push("type");
array.push("name");
array.push("img"); for(var i = 0 ;i< array.length ; i++){
var br = document.createElement("<BR>");
var objE = document.createElement("<INPUT>");
objE.type = "text";
objE.name = array[i];
div.appendChild(objE);
div.appendChild(br);
}
var tx = document.createElement("<TEXTAREA>");
tx.name = "tx";
tx.rows = 10;
tx.cols = 50;
div.appendChild(tx);
}
</script>
<body> <div id = "div"></div>
<input type = "button" onclick = "create();"/>
</body>
</html>
function create(){
var div = document.getElementById("div");
var array = new Array;
array.push("type");
array.push("name");
array.push("img"); for(var i = 0 ;i< array.length ; i++){
var br = document.createElement("<BR>");
var objE = document.createElement("<INPUT>");
objE.type = "text";
objE.name = array[i];
div.appendChild(objE);
div.appendChild(br);
}
var tx = document.createElement("<TEXTAREA>");
tx.name = "tx";
tx.rows = 10;
tx.cols = 50;
div.appendChild(tx);
}