If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Senior Member jf1288's Avatar
    Join Date
    Sep 2003
    Member #
    Javascript's innerHTML wont write code!

    Any ideas on why this doesn't make the erase button? It doesn't give me any errors, so whats up?

    <form name="buttons">
    <table width="600" border="0">
        <td width="178">How many buttons are there?</td>
        <td width="412"><input name="number_of_buttons" type="text" id="number_of_nav" size="3" maxlength="2">
          <input name="growbutton" type="button" id="growbutton" onClick="growlist()" value="Grow List">
            <div id="resetdiv"></div> </td>
        <td colspan="2">
            <script language="JavaScript">
    	  function growlist(){
    	  //define div id's as variables
    	  if (document.buttons.number_of_buttons.value == '' ) {
    	  		alert("How many buttons are there?");
    			return false
    		var listdiv = document.getElementById("buttons");
    		var resetdiv = document.getElementById("resetdiv");
    	  // if the button is active
    	  if (document.buttons.growbutton.disabled == false ){
    	// build however many input boxes the user asks for
    	  		for (i=1; i <= document.buttons.number_of_buttons.value; i++){
    				listdiv.innerHTML +=  "<input type='text' name='button" + i + "'> <br>";
    	// disable box with number, and button
    			document.buttons.growbutton.disabled = true
    			document.buttons.number_of_buttons.disabled = true
    	//build the erase button
    			resetdiv.innerHTML = "<input type='button' value='Erase the button Boxes' onClick='growlist();'>"
    		} else {
    	//ask if user is sure
    			if (confirm("This will erase ALL of the boxes! \n They will be completly gone, along \n with any values in them. \n\n Are you sure you want to do this?")) {
    	// Undisable button and box, erase red inputs, erase the long button
    				document.gather.indbutton.disabled = false
    				document.gather.trials.disabled = false
    				listdiv.innerHTML = ""
    				resetdiv.innerHTML = ""
          <div id="buttons"></div></td>
    If its not in Family Guy its not worth it.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 08:23 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: