I am using a random quotes script on my site which shows random quotes on every click on any site link. Example: random quote 1 on index, if i click login, it shows random quote 2, 3 or 4 and so on. But the problem is that, If this script is on, Whenever i click on any other page of site, such as login, register etc. page does not load normally but instead it loads with a blink.
Here is the script i am using, with the filename quotes.php in my site.
<?php
$quotes = 'Random Text 01
Random Text 02
Random Text 03
Random Text 04
Random Text 05
Random Text 06';
$split_array = explode("\n", $quotes);
$rand_keys = array_rand($split_array, 1);
header("content-type: application/x-javascript");
echo "<!--\n
document.write('{$split_array[$rand_keys]}');\n
//-->";
?>
And it shows up on overall_header.html These are the edits which i made in html file
<ul class="linklist leftside">
<!-- IF not S_IS_BOT and S_USER_LOGGED_IN -->
<li><script type="text/javascript" src="quotes.php"></script></li><!-- ELSE --><li class="quotehead">Important Information from the Administrators --</li><li class="loggedout">Thank you for visiting our forum. Please login to enjoy the full features of our site.</li><!-- ENDIF -->
</ul>
Please tell me what bug in this script is causing blink on every page load.
Regards
your content
"); similar for plain js: var div = document.getElementById('target_div_id'); div.innerHTML = div.innerHTML + 'Extra stuff';(http://stackoverflow.com/questions/5677799/how-to-append-data-to-div-using-javascript) – cox Dec 28 '13 at 12:48