how to show only two text boxes at a time
<p>how to show only two textbox only by next and previous button </p>

<p>this is my code,in this code when i click the next button show two textbox and aging when i click show the next two textbox..totally four textbox..i want only two text box per each click.......how can I achieve that ?
    
    </p>

<pre><code>&lt;script type="text/javascript"&gt;
var max=2;//highest number to go to
var currentIndex=0;
function Previous(){
  if(currentIndex&gt;0){
    currentIndex--;
    postClick();
  }
}
function Next(){
  if(currentIndex&lt;max){
    currentIndex++;
    document.getElementById("div").style.display="none" 
    postClick();
  }
}
function postClick(){//whatever you want to happen goes here    
  var sahan =new Array();
  sahan[currentIndex]==d;
  var d=document.getElementById("div");
  d.innerHTML+="&lt;p&gt;&lt;input type='text' name='name"+currentIndex+"[]'&gt;";
  d.innerHTML+="&lt;p&gt;&lt;input type='text' name='topic"+currentIndex+"[]'&gt;";        
  form1.text1.value=currentIndex;  
}
&lt;/script&gt;

&lt;form name="form1"&gt;
  &lt;input type="button" value="Previous" onclick="Previous()"/&gt;

  &lt;input type="button" value="Next" onclick="Next()"/&gt;

&lt;/form&gt;
&lt;div id="div"&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt; 
</code></pre>
