Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16
  1. #1

    GetElementByClass

    Premetto che di Javascipt non so un tubo!

    Sto cercando di creare dei tooltip a fumetto. Ho trovato questo bellissimo articolo:
    http://javascript.html.it/articoli/l...on-javascript/

    Guardando il codice javascript, ho intuito che il programma agisce solo su degli elementi con id "bubble_tooltip" o "bubble_tooltip_content". Io però vorrei usare delle classi anziché degli id, perché con le classi posso fare più tooltip senza dover, ogni volta, definirli nel css! Andando ad intuito, non mi basta scrivere "GetElementByClass"!

    Quindi, come faccio? :master:



    Grazie per l'aiuto!

    P.S: Se possibile, postate soluzioni il più possibile crossbrowser!
    Earn money for searching the internet:
    Homepages Friends

  2. #2

  3. #3
    Sì, ma integrato nel codice per il tooltip? Lo posto qui...
    codice:
    /************************************************************************************************************
    	(C) www.dhtmlgoodies.com, September 2005
    	
    	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
    	
    	Terms of use:
    	You are free to use this script as long as the copyright message is kept intact. However, you may not
    	redistribute, sell or repost it without our permission.
    	
    	Thank you!
    	
    	www.dhtmlgoodies.com
    	Alf Magne Kalleland
    	
    	************************************************************************************************************/
    	function showToolTip(e,text){
    		if(document.all)e = event;
    		
    		var obj = document.getElementById('bubble_tooltip');
    		var obj2 = document.getElementById('bubble_tooltip_content');
    		obj2.innerHTML = text;
    		obj.style.display = 'block';
    		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    		var leftPos = e.clientX - 100;
    		if(leftPos<0)leftPos = 0;
    		obj.style.left = leftPos + 'px';
    		obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
    	}	
    	
    	function hideToolTip()
    	{
    		document.getElementById('bubble_tooltip').style.display = 'none';
    		
    	}
    Earn money for searching the internet:
    Homepages Friends

  4. #4
    UP
    Earn money for searching the internet:
    Homepages Friends

  5. #5
    Dunque, un esempio di getElementsByClass potrebbe essere il seguente:

    codice:
    function getElementsByClass(nome_classe)
    {
       var tutti = document.getElementsByTagName('*')
       var elementi = new Array()
       for (var i = 0; i < tutti.length; i++)
       {
          if ( tutti.item(i).className == nome_classe )
          {
             elementi.push(tutti.item(i))
          }
       }
       return elementi
    }

  6. #6
    Sì, ma integrato con il codice per le tooltip che ho postato sopra??
    Earn money for searching the internet:
    Homepages Friends

  7. #7
    Pierofix?
    Earn money for searching the internet:
    Homepages Friends

  8. #8
    Uff! C'ho troppo mal di testa, right now. Non è che potresti pazientare fino a domani? Prendo fiato e mi ci tuffo.

  9. #9
    Se proprio devo...

    E' ovvio! Grazie per l'aiuto! Mi aiuti gratis e dovrei pure lamentarmi? :rollo:
    Earn money for searching the internet:
    Homepages Friends

  10. #10
    Gratis? Ma come gratis?!? Mi avevano detto che cominciavano a pagare tutti i post dopo l'undicimillessimo!!!

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 © 2024 vBulletin Solutions, Inc. All rights reserved.