Ver Mensaje Individual
  #4 (permalink)  
Antiguo 14/04/2011, 05:33
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Mejorar o Corregir

si únicamente tienes ese código en la página, ie no levanta ningún error. en cuanto a mejorarlo, yo lo haría así
Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TITULO</title>
<style type="text/css">
form input {
border-width: 0;
background-color: #FFF;
color: red;
cursor: pointer;
}

form input:hover {
text-decoration: underline;
}
</style>

<script type="text/javascript">
function evt (elemento,nomevento,funcion) {
if (elemento.attachEvent)
{
var fnc=function(){
funcion.call(elemento,window.event);
}
elemento.attachEvent('on'+nomevento,fnc);
return true;
}
else
if (elemento.addEventListener)
{
elemento.addEventListener(nomevento,funcion,false) ;
return true;
}
else
return false;
}


function init() {
for(var i = 0, control = document.getElementsByTagName('input'); i < control.length; i++)
evt(control[i], 'click', function () {valida('ABC', this.id);});
}


evt(window, 'load', init);

function valida(param, nodo){

switch(nodo){

case 'vta_area':
if(param.indexOf('D') == -1){
alert('Sin derechos para esta Opcion');
}else{
alert('Ventas por Area');
window.location.href = 'ventas.php';
//document.getElementById(nodo).setAttribute('href', 'ventas.php');
}
break;

case 'vta_glob':
if(param.indexOf('C') == -1){
alert('Sin derechos para esta Opcion');
}else{
alert('Ventas Global');
window.location.href = 'ventas_global.php';
//document.getElementById(nodo).setAttribute('href', 'ventas_global.php');
}
break;

}
}
</script>

</head>

<body>
<form>
<input type="button" value="Ventas x Area" id="vta_area" />
<input type="button" value="Ventas Global" id="vta_glob" />
<form>
</body>
si no entiendes algo, pregunta