I have a Javascript For Loop...
var CookieName = "Tab,EduTab,EduTab,user";
var tString = CookieName.split(',');
for(i = 0; i < tString.length; i++){
if (tString[i] == "EduTab") {
document.write("<b>"+tString[i]+"<b>");
} else {
document.write(tString[i]);
}
}
For some reason it is failing to bold the 'EduTab'. It will either bold the entire array CookieName or none at all. Any help would be awesome. Thanks.
I have a Javascript For Loop...
var CookieName = "Tab,EduTab,EduTab,user";
var tString = CookieName.split(',');
for(i = 0; i < tString.length; i++){
if (tString[i] == "EduTab") {
document.write("<b>"+tString[i]+"<b>");
} else {
document.write(tString[i]);
}
}
For some reason it is failing to bold the 'EduTab'. It will either bold the entire array CookieName or none at all. Any help would be awesome. Thanks.
Share Improve this question asked Feb 15, 2012 at 17:21 JoeJoe 1,6457 gold badges26 silver badges34 bronze badges2 Answers
Reset to default 7You aren't closing the <b>
tag
document.write("<b>"+tString[i]+"<b>")
should be
document.write("<b>"+tString[i]+"</b>")
You are missing the /
in your closing tab </b>