作者a7752035 (uishi)
看板Ajax
标题[问题] javascript新增选单的问题
时间Sun Jun 7 17:47:11 2009
我这个例子只能新增一个选单,然後就不能在新增了
请问一下,我要怎麽每按ㄧ次就新增一个选单?
而select name 每次都不ㄧ样?
我是初学javascript 请高手帮忙
下面是我的原始码:
<%@ page contentType="text/html; charset=big5" language="java" import="java.sql.*" errorPage="" %>
<%@page import ="java.io.IOException"%>
<!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=big5" />
<title>无标题文件</title>
</head>
<script language="javascript">
function add() {
var str = '';
str += '<select name="s1">';
str += '<option value="PC">桌上型电脑</option>';
str += '<option value="NB">笔记型电脑</option>';
str += '</select>';
//取出 id 为 newAdd 的物件,并塞入 str 的内容
int i;
for(i=0;i>=1;i++)
}
</script>
<body>
<form id="form1" name="form1" method="post" action="">
<label></label>
<label>
<input type="button" value="+" onclick="add()">
<span id="newAdd"></span>
<br />
</label>
<input name="Submit2" value="新增内容" onClick="addRowInnerHTML('test')" type="button"></td>
</form>
</body>
</html>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.68.92.166