使用javascript绑定ddl中的数据 [英] bind data in ddl using javascript
本文介绍了使用javascript绑定ddl中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< script type ="text/javascript">
函数fillDropDown()
{
var arr = new Array(2);
arr [0] =嗨";
arr [1] ="Hellow";
arr [0] =``< option>''+ arr [0] +``</option>'';
arr [1] =``< option>''+ arr [1] +``</option>'';
var newHTML =``< select>''+ arr [0] + arr [1] +''</select>'';
}
</script>
<script type="text/javascript">
function fillDropDown()
{
var arr = new Array(2);
arr[0] = ''Hi'';
arr[1] = ''Hellow'';
arr[0] = ''<option>''+ arr[0] + ''</option>'';
arr[1] = ''<option>''+ arr[1] + ''</option>'';
var newHTML = ''<select>''+ arr[0] + arr[1] + ''</select>'';
}
</script>
推荐答案
< html xmlns ="http://www.w3.org/1999/xhtml">
< head runat ="server">
< title>无标题页面</title>
< script type ="text/javascript">
函数fillDropDown()
{
var arr = new Array(2);
arr [0] =嗨";
arr [1] ="Hellow";
arr [0] =``< option>''+ arr [0] +``</option>'';
arr [1] =''< option>''+ arr [1] +</option>'';
var newHTML =``< select>''+ arr [0] + arr [1] +''</select>'';
myDiv.innerHTML = newHTML;
}
</script></head>< body><> < form id ="form1" runat ="server">
< div>
< input onclick ="fillDropDown()" type ="button" value ="fillDropDown"/>
</div>
< div id ="myDiv">
< select>
</select>
</div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function fillDropDown()
{
var arr = new Array(2);
arr[0] = ''Hi'';
arr[1] = ''Hellow'';
arr[0] = ''<option>''+ arr[0] + ''</option>'';
arr[1] = ''<option>''+ arr[1] + ''</option>'';
var newHTML = ''<select>''+ arr[0] + arr[1] + ''</select>'';
myDiv.innerHTML = newHTML;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input onclick="fillDropDown()" type="button" value="fillDropDown" />
</div>
<div id="myDiv">
<select>
</select>
</div>
</form>
</body>
</html>
这不是问题.您刚刚发布了一些代码,没有任何解释或查询.
This is not a question. You''ve just posted some code with no explanation or inquiry.
这篇关于使用javascript绑定ddl中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文