Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    premo button e scompare il button, perchè?

    Ciao!
    Ho scritto questo semplice e breve codice:
    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    	<title>esercizio</title>
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    	<script type="text/javascript" src="./js/prototype.js"></script>
    
    	<script type="text/javascript">
    	
    	var ESE = Class.create();
    
    	ESE.prototype = {
    
        	initialize: function (element) {
    				this.addObservers(element);
    			},
    			
    		addObservers: function(element) {
    				Event.observe(element, "click", this.addButton.bind(this));
    			},
    			
    		addButton : function (event) {
    				var elt = Event.element(event);
    				var f = new Element("form");
    				var b = new Element("button");
    				
    				elt.update();
    				elt.insert(f);
    				f.insert(b);
    
    				b.innerHTML = "OK";			
    			}
    	};
    
    	
    	var esercizio = function () {
    		var es = new ESE($('prova'));
    	}
    	
    	document.observe("dom:loaded", esercizio);
    
    	
    	</script>
    
    
    </head>
    <body>
    
    <div id="prova"> CLICCA QUI </div>
        
    </body>
    </html>
    Se clicco su "CLICCA QUI" appare correttamente il bottone "OK".
    Se clicco sul bottone "OK", il bottone scompare. Coma mai? Come faccio a fare in modo che non scompaia?
    Grazie!!!

  2. #2
    Per ora ho sistemato cambiando il tag "button" con <input type="button" value="OK">
    Però non capisco perchè con "button" scompare al premere del bottone...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.