我有一个创建两组表单的脚本 - 每组有 12 个表单,每个表单都有一个下拉输入菜单
我有两个问题: 1. 当我使用 document.getElementById().innerHTML 而不是 document.write 时,我没有得到相同的外观。2. 使用 document.write - 如何使第二组表单向左浮动?
TIA
这是代码:
var names = ["Sun", "Moon", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto", "MC", "Asc"]
var signs = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"]
document.write("<body>")
for (j=0;j<(12);j++){
document.write("<form id=" + "\"" + j + "\">")
document.write("<select id=" + "\'" + j + "\'" + "onchange='OnChange();'>")
for (i=0;i<(12);i++){
document.write("<option value=" + i + " name=" + signs[i] + ">" + signs[i] + "</option>")
}
document.write("</select><input type=" + "\"text\"><input type=" + "\"text\">" + names[j] + "<br>")
document.write("</form>")
}
document.write("<br>")
document.write("<body>")
for (j=12;j<(24);j++){
document.write("<form id=" + "\"" + j + "\">")
document.write("<select id=" + "\'" + (j-12) + "\'" + "onchange='OnChange();'>")
for (i=0;i<(12);i++){
document.write("<option value=" + i + " name=" + signs[i] + ">" + signs[i] + "</option>")
}
document.write("</select><input type=" + "\"text\"><input type=" + "\"text\">" + names[j-12] + "<br>")
document.write("</form>")
}
document.write("<br>")