Html Formating in Javascript Variable
Hello,
I have a simple question but I can't seem to figure it out.
Code:
<script>
var msgIX = 0
var msgs = new Array(
"1",
"2"
)
function scrollMessages(milliseconds) {
window.setInterval("displayMessage()", milliseconds)
}
function displayMessage() {
if(document.getElementById != null) {
var heading = document.getElementById("scrollme")
heading.firstChild.nodeValue = msgs[msgIX]
}else{
if(navigator.appName == "Microsoft Internet Explorer") {
var heading = document.all.item("scrollme")
heading.innerText = msgs[msgIX]
}
}
++msgIX
msgIX %= msgs.length
}</script>
<body onload="scrollMessages(2000)">
<h1 align="center" id="scrollme">0</h1>
So basically 1 and 2 change but I am wondering how I can display the text with html formatting in them.
For example, in the array, I want each variable to display the following
"sample text <br /> -author"
"sample text 2 <br /> -author 2"