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

    [DIFFICILE] aiuto x debug script

    ciao a tutti, ho uno script che serve a visualizzare immagini (div) in osizione relativa rispetto ad un link con onmouseover,in pratica una sott l'altra al passaggio del mouse.

    il problema è che va solo in ie6, mentre è garantito come compatibile con ns...

    Ho avuto il consenso scritto dell'autore x modificarlo. mi date una mano? x me è troppo complesso...

    codice:
    /*
    Extended Tooltip Javascript
    copyright 9th August 2002, by Stephen Chapman, Felgall Pty Ltd
    
    permission is granted to use this javascript provided that the below code is not altered
    
    THIS COPY WAS MODIFIED BY MDSJACK UNDER PERMISSION OF THE AUTHOR
    */
    var DH = 0;
    var an = 0;
    var al = 0;
    var ai = 0;
    if (document.getElementById){ // NS6 + IE
    	ai = 1;
    	DH = 1;
    }else{
    	if (document.all){ // NS5
    		al = 1;
    		DH = 1;
    	}
    	else{
    		browserVersion = parseInt(navigator.appVersion); // NS4
    		if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)){
    			an = 1;
    			DH = 1;
    		}
    	}
    }
    
    function fd(oi,ws){
    	if (ws == 1){
    		if (ai){ // NS6 + IE
    			return (document.getElementById(oi).style);
    		}else{
    			if (al){ // NS5
    				return (document.all[oi].style);
    			}else{
    				if (an){ // NS4
    					return (document.layers[oi]);
    				}
    			};
    		}
    	}else{
    		if (ai){ // NS6 + IE
    			return (document.getElementById(oi));
    		}else{
    			if (al){ // NS5
    				return (document.all[oi]);
    			}else{
    				if (an){ // NS4
    				}
    			}
    		}
    	}
    }
    
    function pw(){
    	if (window.innerWidth != null) return window.innerWidth; // Netscape
    	if (document.body.clientWidth != null) return document.body.clientWidth; // Interntet Explorer
    	return (null);
    }
    
    function popup(evt,oi,USERtv){
    	if (DH){
    		var wp = pw();
    		ds = fd(oi,1);
    		dm = fd(oi,0);
    		st = ds.visibility;
    		if (dm.offsetWidth) ew = dm.offsetWidth;
    		else if (dm.clip.width) ew = dm.clip.width;
    		if (st == 'visible' || st == 'show'){
    			ds.visibility = 'hidden';
    		}else{
    			if (evt.y || evt.pageY){
    				// Top Margin
    				if (evt.pageY){
    					tv = evt.pageY + 20;
    					lv = evt.pageX - (ew/4);
    				}else{
    					tv = evt.y + 20 + document.body.scrollTop;
    					lv = evt.x - (ew/4) + document.body.scrollLeft;
    				}
    				if (lv < 2) lv = 2;
    				else if (lv + ew > wp) lv -= ew/2;
    //				ds.left = lv;
    //				ds.top = tv;	
    			}
    			ds.top = USERtv;
    			ds.left = 161;
    			ds.visibility = 'visible';
    		}
    	}
    }
    /* END of Extended Tooltip Javascript */

    si richiama così:
    codice:
    onmouseover="popup(event,'frame',517);"
    dove 517 è l'altezza dal margine superiore.


    GRAZIE MILLE IN ANTICIPO! :metallica

  2. #2

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2002
    Messaggi
    633
    con Netscape devi specificare sempre l'unita di misura con cui setti gli attributi di stile per il posizionamento, per cui devi cambiare le parti in cui c'è:

    ds.top = USERtv;
    ds.left = 161;

    in

    ds.top = USERtv+"px";
    ds.left = 161+"px";


    ciauz
    Alcuni miei articoli in PRO.HTML.IT: JavaScript | DHTML | DOM
    Sviluppo : wedev | forum

  4. #4
    GRAZIE! ORA PROVO... :|

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.