1.创建链接
<BODY>
<script language="JavaScript">
var o = ;
//创建链接
function createA(url,text)
{
var a = ("a");
= url;
= text;
= "red";
(a);
}
createA("http:///","hao");
</script>
</BODY>
<script language="JavaScript">
var o = ;
//创建链接
function createA(url,text)
{
var a = ("a");
= url;
= text;
= "red";
(a);
}
createA("http:///","hao");
</script>
</BODY>
2.创建DIV
<body>
<script language="javascript">
var o = ;
//创建DIV
function createDIV(text)
{
var div = ("div");
= text;
= "red";
(div);
}
createDIV("div");
</script>
</body>
<script language="javascript">
var o = ;
//创建DIV
function createDIV(text)
{
var div = ("div");
= text;
= "red";
(div);
}
createDIV("div");
</script>
</body>
3.创建表单项
<BODY>
<script language="javascript">
var o = ;
//创建表单项
function createInput(sType,sValue)
{
var input = ("input");
= sType;
= sValue;
(input);
}
createInput("button","aa");
</script>
</BODY>
<script language="javascript">
var o = ;
//创建表单项
function createInput(sType,sValue)
{
var input = ("input");
= sType;
= sValue;
(input);
}
createInput("button","aa");
</script>
</BODY>
4.创建表格
<BODY>
<script language="javascript">
var o = ;
//创建表格
function createTable(w,h,r,c)
{
var table = ("table");
var tbody = ("tbody");
= w;
= h;
= 1;
for(var i=1;i<=r;i++)
{
var tr = ("tr");
for(var j=1;j<=c;j++)
{
var td = ("td");
= i + "" + j;
//((i + "" + j));
= "#FF0000";
(td);
}
(tr);
}
(tbody);
(table);
}
createTable(270,270,9,9);
</script>
</BODY>
<script language="javascript">
var o = ;
//创建表格
function createTable(w,h,r,c)
{
var table = ("table");
var tbody = ("tbody");
= w;
= h;
= 1;
for(var i=1;i<=r;i++)
{
var tr = ("tr");
for(var j=1;j<=c;j++)
{
var td = ("td");
= i + "" + j;
//((i + "" + j));
= "#FF0000";
(td);
}
(tr);
}
(tbody);
(table);
}
createTable(270,270,9,9);
</script>
</BODY>
4.创建按钮,文本框 并窗体传值()
<script type="text/javascript">
var index = 2;
function addEle() {
var txt = ("input");
("type", "input");
("id", "txt" + index);
var txt = ("input");
("type", "input");
("id", "txt" + index);
var btn = ("input");
("type", "`");
("id", "btn" + index);
("value", "取值");
("onclick", "openWindow()");
("type", "`");
("id", "btn" + index);
("value", "取值");
("onclick", "openWindow()");
var br = ("br");
("content").appendChild(txt);
("content").appendChild(btn);
("content").appendChild(br);
("content").appendChild(btn);
("content").appendChild(br);
index++;
}
function openWindow() {
var returnVal = ("", "", "");
var srcID = ;//触发事件的对象.
var ind = (3,);
for (var i in returnVal) {
("txt" + ind).value += returnVal[i]+" ";
}
}
</script>
<
script type="text/javascript">
function sub() {
var arr = ("input");
var val = new Array();
for (var i in arr) {
if (arr[i].type == "checkbox") {
if (arr[i].checked) {
val[] = arr[i].value;
}
}
}
= val;
();
}
</script>
function sub() {
var arr = ("input");
var val = new Array();
for (var i in arr) {
if (arr[i].type == "checkbox") {
if (arr[i].checked) {
val[] = arr[i].value;
}
}
}
= val;
();
}
</script>