フォームの 2 つのセットを作成するスクリプトがあります。各セットには 12 のフォームがあり、それぞれにドロップダウン入力メニューがあります。
2 つの質問があります。 1. document.write の代わりに document.getElementById().innerHTML を使用すると、同じ外観が得られません。2. document.write の使用 - 2 番目のフォーム セットを左にフロートさせるにはどうすればよいですか?
ティア
コードは次のとおりです。
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>")