Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/04/2003, 17:45
Avatar de duchamp
duchamp
 
Fecha de Ingreso: enero-2002
Ubicación: Patagonia
Mensajes: 216
Antigüedad: 22 años, 4 meses
Puntos: 1
Por si ayuda, adjunto aquí el código del archivo windows.js

Código:
function changeFont(id) {

    // change lineheight
    if (document.getElementById) {
        document.getElementById(id).style.fontSize = newsfont+"px";
    } else {
        if (document.layers) {
            document.layers[id].fontSize = newsfont+"px";
        } else {
            if (document.all) {
				eval("document.all." + id + ".style.fontSize = \"" + newsfont + "px \"");
            }
        }
    }
	
    // fix layer scrolling problems now
    updateHeight(); 
    setCookie();
}

function larger() {
    if (newsfont < 25) {
    	newsfont= newsfont +2;
    	changeFont('content');
    }
}

function smaller() {
    if (newsfont > 5) {
	newsfont= newsfont-2;
	changeFont('content');
    }
}

Y aquí el código del archivo cookie.js

Código:
// functions to store font size in a cookie

cookie_name = "fontsize";

function setCookie() {

    if(document.cookie != document.cookie) { 
	index = document.cookie.indexOf(cookie_name);
    }
    else { 
	index = -1;
    }

    if (index == -1) {
	document.cookie=cookie_name+"="+newsfont+"; expires=Monday, 04-Apr-2008 05:00:00 GMT";
    }

}



function getCookie() {
    if(document.cookie) {
	index = document.cookie.indexOf(cookie_name);
	if (index != -1) {
	    namestart = (document.cookie.indexOf("=", index) + 1);
	    nameend = document.cookie.indexOf(";", index);
	    if (nameend == -1) nameend = document.cookie.length;
	    val = document.cookie.substring(namestart, nameend);
	    return parseInt(val);
	}
    }
}

Y esto es lo que utilizan en los botones para ejecutar la acción:


Código:
<A onmousedown="larger();return false;" 
      onmouseover="window.status='_Magnify Text'; return true" 
      onmouseout="window.status='';return true" href="javascript:void(0);"><IMG 
      height=16 src="magnify.gif" width=22 border=0></A>
    <A onmousedown="smaller();return false;" 
      onmouseover="window.status='_Demagnify Text';return true;" 
      onmouseout="window.status='';return true" href="javascript:void(0);"><IMG 
      height=16 src="demagnify.gif" width=22 border=0></A>
Las imagenes:





Faltaría la hoja de estilos, claro. Pero ya es demasiado -creo-
__________________
_____________________
Duchamp