Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <title>Array Cycle Demo</title>
- </head>
- <body>
- <script type="text/javascript">
- var links = [
- 'Start Of List',
- 'ABC',
- 123,
- 'XYZ',
- 'End Of List'
- ]
- var clicks = 0;
- function onClick() {
- clicks = clicks % links.length;
- document.getElementById("clicks").innerHTML = links[clicks];
- clicks += 1;
- };
- </script>
- <button type="button" onClick="onClick()">Click Me</button>
- <p>Array Element: <a id="clicks">***</a></p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement