我似乎无法调整输入和选择标签的宽度。我已经正确排队了JS文件。我没有做任何更改输入或选择标签的格式的操作,并且在每个输入之间都存在不必要的换行符。这是我正在使用的。
for (let i=0;i<eventsEntered && i<40;i++) {
formBlanks = formBlanks + "<input type = "text" class = "formField" id ="eventName${i}" placeholder="Event Name">
<select class = "raceType" id = "raceType${i}" style ="width: 30%;"> <option value="Road Race">Road Race</option> <option value="Criterium">Criterium</option> <option value="GC">GC</option></select>
<input type = "text" id = "place${i}" placeholder = "Place" style= "width: 150px;">
<input type = "text" id="fieldSize${i}" placeholder = "Field Size" style ="width: 100px;">
<p style="display:inline" id="points${i}"></p><br> ";
};//this loop creates a string variable that holds the html code for each individual row of the event forms
formBlanks = formBlanks + "<button onclick="eventCalc()">Calculate</button> <p id="catUp"></p>";
document.getElementById("jsOut").innerHTML = formBlanks;
formBlanks = "";
}
答案 0 :(得分:2)
您在双引号中使用了双引号,这意味着您正在打开和关闭字符串。 Javascript支持双引号(“)和单引号(')以及反引号(`)表示字符串,而HTML仅支持双引号。由于您通过SELECT surname,
first_name
FROM wgb_customer
NATURAL JOIN wgb_account
MINUS
SELECT surname,
first_name
FROM wgb_account_type
NATURAL JOIN wgb_account
NATURAL JOIN wgb_customer
WHERE Account_description = 'RRSP'
使用字符串插值,因此需要使用后记号。
以下是您的代码的固定版本,该代码应 起作用:
${}
但是,IE不支持反引号,这意味着在字符串中有变量for (let i=0;i<eventsEntered && i<40;i++) {
formBlanks = formBlanks + `<input type = "text" class = "formField" id ="eventName${i}" placeholder="Event Name">
<select class = "raceType" id = "raceType${i}" style ="width: 30%;"> <option value="Road Race">Road Race</option> <option value="Criterium">Criterium</option> <option value="GC">GC</option></select>
<input type = "text" id = "place${i}" placeholder = "Place" style= "width: 150px;">
<input type = "text" id="fieldSize${i}" placeholder = "Field Size" style ="width: 100px;">
<p style="display:inline" id="points${i}"></p><br> `;
};//this loop creates a string variable that holds the html code for each individual row of the event forms
formBlanks = formBlanks + `<button onclick="eventCalc()">Calculate</button> <p id="catUp"></p>`;
document.getElementById("jsOut").innerHTML = formBlanks;
formBlanks = "";
的任何地方都需要使用字符串连接。