Please have a look at the following code :
<div id="flashwelcome" style="display: none">
<h2 align="center">
<script language="JavaScript1.2">
var message = "Welcome to Dynamic Report Generation POC"
var neonbasecolor = "green"
var neontextcolor = "blue"
var neontextcolor2 = "red"
var flashspeed = 200 // speed of flashing in milliseconds
var flashingletters = 3 // number of letters flashing in neontextcolor
var flashingletters2 = 1 // number of letters flashing in neontextcolor2 (0 to disable)
var flashpause = 0 // the pause between flash-cycles in milliseconds
/**
* No need to edit below this line
*/
var n = 0
if (document.all || document.getElementById) {
document.write('<font color="' + neonbasecolor + '">')
for (m = 0; m < message.length; m++)
document.write('<span id="neonlight' + m + '">' + message.charAt(m) + '</span>')
document.write('</font>')
} else {
document.write(message)
}
function crossref(number) {
var crossobj = document.all ? eval("document.all.neonlight" + number) : document.getElementById("neonlight" + number)
return crossobj
}
function neon() {
/**
* Change all letters to base color
*/
if (n == 0) {
for (m = 0; m < message.length; m++)
crossref(m).style.color = neonbasecolor
}
/**
* cycle through and change individual letters to neon color
*/
crossref(n).style.color = neontextcolor
if (n > flashingletters - 1) crossref(n - flashingletters).style.color = neontextcolor2
if (n > (flashingletters + flashingletters2) - 1) crossref(n - flashingletters - flashingletters2).style.color = neonbasecolor
if (n < message.length - 1) {
n++
} else {
n = 0
clearInterval(flashing)
setTimeout("beginneon()", flashpause)
return
}
}
function beginneon() {
if (document.all || document.getElementById) flashing = setInterval("neon()", flashspeed)
}
beginneon();
</script>
</h2>
</div>
and this is how i hide the above div tag but it is not getting hidden,
document.getElementById("flashwelcome").style.display = 'none';
I don’t think that there is some problem but still the div tag is not hidden.
Please help me to find the problem.
Regards
Assuming that you are using the code to hide the div within a script tag and said script element is embedded within the document below where the div with id=flashwelcome is, this should work fine. If it doesn’t, check that JavaScript is enabled within your browser.
Ensure your code looks something like this:
Furthermore, you do realise that you’re using inline css to hide the "flashwelcome" div initially?
As Musa noted in the comments: that javascript you are using within the h2 tag (?) is very old. As for its functionality: are you sure flashing text like that is what your users really want to see on your website?