echo '<script>document.getElementById("xueli").value = "本科"</script>'
<option value="<?=$rows[Cid]?>"><?=$rows[Cname]?></option><option value="<仔猛?=$rows['Cid']?>">念陪桥<?=$rows['Cname']?></option>
数组里面key为字符串的应该加引号 如果为数字乱瞎就不用加了
<!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" />
<title>无标题文档</title>
<script type="text/javascript">
<!--
var i = 0
function form( textobj, selectobj, divobj ) { //增加元素
var newHtml = document.createElement('div')
newHtml.id = divobj + i
newHtml.innerHTML = '<input type="text" name="' + textobj + '" \/><select name="' + selectobj + '"><option>请选择<\/option><\/select><a href="javascript:" onclick="del(\'' + ( divobj + i ) + '\')">删除<\/a>'
察慧乱 document.getElementById(divobj).appendChild( newHtml )
i++
}
function del( objs ) { //删碧粗除元素
var object = document.getElementById( objs )
object.parentNode.removeChild( object )
}
//-->
</script>
<style>
div{position:relativez-index:0 margin:10px auto}
a{color:#03F text-decoration:none}
</style>
</head>
<body>
<div id="ins">
<input type="text" name="baiyi" />
<select name="zhuli">
<option>请选择</option>
</select>
</div>
<a href="javascript:" onclick="form('baiyi[]', 'zhuli[]', 'ins')">增加</a>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)