php - Hide next button for last quiz in quiz application -


i making quiz application using php. right problem last question showing next button shown in image quiz

since questions dynamically fetched db there no pages each question. not able specify @ point should hide next button (what if have 1000 questions). have tried javascript. doesn't quiet seem work.

update source code

demo: http://jsfiddle.net/e4ny6/2/

use

var numquestions,     navs; function init() {   cd();   numquestions = document.getelementsbyclassname("qbutton").length;   navs = document.getelementsbyclassname('navbutton');   show(0); }  function show(i) {     document.getelementsbyclassname("current")[0].classname="qbutton";     document.getelementsbyclassname("active")[0].classname="qpanel";      document.getelementsbyclassname("qpanel")[i].classname+=" active";     document.getelementsbyclassname("qbutton")[i].classname+=" current";      navs[0].style.display = i===0 ? 'none' : '';     navs[1].style.display = i===numquestions-1 ? 'none' : '';      currentquestion=i; } 

... instead of functions init , show.

offtopic:

if want improve performance, store document.getelementsbyclassname calls in variable inside init(). way expensive calls once.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -