我有以下代码
void testAddOne() {
assertTrue(notes.count() == 0);
notes.addLast("do");
assertTrue(notes.count() == 1);
}
function notEmpty() {
var myText1 = document.getElementById('txf1');
var myText2 = document.getElementById('txf2');
var myText3 = document.getElementById('txf3');
var myText4 = document.getElementById('txf4');
var myText5 = document.getElementById('txf5');
if (myText1.value != "" && myText2.value != "" && myText3.value != "" && myText4.value != "" && myText5.value != "")
document.getElementById("result").innerHTML = "Cópiala y pégala en tu documento. La ficha bibliográfica es : <br /><br /> " + myText1.value + ". (" + myText2.value + "). " + myText3.value + '. ' + myText4.value + ": " + myText5.value + ".";
else {
alert("Rellena todos los huecos, por favor.");
}
}
h1 {
position: relative;
background-color: rgb(127, 159, 219);
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
color: white;
text-align: left;
font-size: 30px;
margin-top: 0px;
height: 70px;
border-bottom-style: solid;
border-color: black;
border-width: 2px;
}
body {
width: 100%;
height: 100%;
margin: 0%;
padding: 0%;
left: 0%;
top: 0%;
background-color: darkred;
font-size: 12px;
text-align: left;
color: white;
}
button {
font-size: 15px;
margin-left: 40%;
}
我只想在用户得到全部内容时以斜体显示myText3的值。我想避免使用Jquery,因为我一直致力于只学习javascript而不会感到不知所措,但是我也很喜欢Jquery示例:)。非常感谢您的提前帮助。
答案 0 :(得分:0)
更改此行:
document.getElementById("result").innerHTML = "Cópiala y pégala en tu documento. La ficha bibliográfica es : <br /><br /> " + myText1.value + ". (" + myText2.value + "). " + myText3.value + '. ' + myText4.value + ": " + myText5.value + ".";
收件人
document.getElementById("result").innerHTML = "Cópiala y pégala en tu documento. La ficha bibliográfica es : <br /><br /> " + myText1.value + ". (" + myText2.value + "). <em>" + myText3.value + '</em>. ' + myText4.value + ": " + myText5.value + ".";
在emphasis tags中包装text3.value
会使它变为斜体。