Random tip / info-box with javascript array
<p id="cw_js_random_tips">This is reserved-place for a random tip.
Put it somewhere on your website.
In this example p must be placed above javascript-code.</p>
<script language="javascript">
var myarray=new Array();
myarray[0] = "The content of first index ";
myarray[1] = "Something for second index ";
myarray[2] = "Something for third index ";
// ...
var randNr = Math.floor(Math.random()*myarray.length);
// alert(myarray[randNr]);
// use advanced javascript to display content somewhere on your page
document.getElementById('cw_js_random_tips').innerHTML = myarray[randNr];
</script>
Bookmark/Search this post with
Tags:
Similar entries
- Sleep Function for JavaScript like PHP
- Hide your email address + mailto link with javascript from spammer
- Check password safety with JavaScript while typing
- Common HTML / Web colors
- Change background color onmouseover with Javascript
- Redirect webpages with HTML, PHP, .htaccess, Java+Script, CGI-Perl, ASP.NET and ColdFusion
- WebSearch
- How to hide / encrypt CCK Email field with JS against spammer
- Register Globals Emulator for PHP
- A simple website structure
- Pure CSS Mouseover Menu without Javascript
- Google Analytics to track visitors if javascript disabled?
- Simple Hello World Module for Drupal 6
- DropDown / Rollover Menu with pure CSS / HTML
- Redirect a query to multiple search engines with one form and javascript
- web development tool Firebug for Firefox
- Google's bloody javascript annoying
- How GoogleBot index AJAX powered websites?
- How to make website popular
- List of Domains with Google PageRank 10

Comments
Post new comment