我对javascript很陌生,我无法弄清楚如何更改for / in循环中第一个“ document.write”的颜色? -> document.write(schedule [row] ['title']); <-
var schedule = [], row, col;
var TECH276 = { title : "JavaScript Fundamentals",
credits : 3,
section : 1,
days : "Thursday",
time : "6:30 p.m. - 9:25 p.m.",
semester : "Spring 2019",
fascinating : true
};
var TECH277 = { title : "Advanced Javascript",
credits : 3,
section : 1,
days : "Thursday",
time : "6:30 p.m. - 9:05 p.m.",
semester : "Fall 2019",
fascinating : true
};
schedule[0] = TECH276;
schedule[1] = TECH277;
for (row in schedule) {
document.write(schedule[row]['title']);
document.write("<br />");
for (col in schedule[row]) {
document.write('The property ' + "<i>" + col + "</i>" + ' = <b>'+ schedule[row][col] + "</b> <br>");
}
document.write("<br />");
}
答案 0 :(得分:1)
只需将其包装在P
中并设置样式:
span