Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Toggle</title>
- </head>
- <body>
- <script>
- var classes = ["cam","cam1","cam2"]
- currentstate = 0
- nextstate=currentstate+1
- function toggle(){
- if (currentstate == classes[2]){
- nextstate = classes[0]
- }
- else{
- cam = document.getElementById("cam")
- cam.innerHTML=currentstate;
- currentstate = classes[currentstate+1]
- }
- }
- </script>
- <input type="button" value="Click Here" onclick="toggle()" />
- <div id="cam">
- test
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment