Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/02/2010, 08:16
userman
 
Fecha de Ingreso: diciembre-2006
Mensajes: 173
Antigüedad: 17 años, 4 meses
Puntos: 2
Funciona en IE pero no en Mozilla.

Hola,

alguien me podria decir porque me falla el siguiente javascript en el navegador Mozilla?? en Internet Explorer y Google Chrome me funciona bien.

Código:
var ie45,ns6,ns4,dom;
if (navigator.appName=="Microsoft Internet Explorer") ie45=parseInt(navigator.appVersion)>=4;
else if (navigator.appName=="Netscape"){  ns6=parseInt(navigator.appVersion)>=5;  ns4=parseInt(navigator.appVersion)<5;}
dom=ie45 || ns6;

var http=createRequestObject();
var objectId = '';
var loadok = 0;

function createRequestObject(htmlObjectId){
    var obj;
    var browser = navigator.appName;
    
    if(browser == "Microsoft Internet Explorer"){
        obj = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else{
        obj = new XMLHttpRequest();
    }
    return obj;    
}

function sendReq(serverFileName, variableNames, variableValues,objId) {
	var paramString = '';
	
	objectId = objId;
	
	variableNames = variableNames.split(',');
	variableValues = variableValues.split(',');
	
	for(i=0; i<variableNames.length; i++) {
		paramString += variableNames[i]+'='+variableValues[i]+'&';
	}
	paramString = paramString.substring(0, (paramString.length-1));
			
	if (paramString.length == 0) {
	   	http.open('get', serverFileName);
	}
	else {
		http.open('get', serverFileName+'?'+paramString);
	}
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
	
	if (http.readyState == 4) {
		responseText = http.responseText;
		getobj(objectId).innerHTML = responseText;
    } else {
		getobj(objectId).innerHTML = "<br><div align=center><img src='images/loading.gif' border=0><br>Loading content ...</div>";
	}
		
}

function change_icon(imgDocID,url) {
document.images[imgDocID].src = url;
}  

function showhide(id) {
el = document.all ? document.all[id] :   dom ? document.getElementById(id) :   document.layers[id];
els = dom ? el.style : el;
  if (dom){
    if (els.display == "none") {
        els.display = "";
      } else {
        els.display = "none";
      }
    }
  else if (ns4){
    if (els.display == "show") {
        els.display = "hide";
      } else { 
      els.display = "show";
         }
  }
}

function getobj(id) {
el = document.all ? document.all[id] :   dom ? document.getElementById(id) :   document.layers[id];
return el;
}

function showobj(id) {
obj=getobj(id);
els = dom ? obj.style : obj;
 	if (dom){
	    els.display = "";
    } else if (ns4){
        els.display = "show";
  	}
}

function hideobj(id) {
obj=getobj(id);
els = dom ? obj.style : obj;
 	if (dom){
	    els.display = "none";
    } else if (ns4){
        els.display = "hide";
  	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openPopUp(url, windowName, w, h, scrollbar) {
           var winl = (screen.width - w) / 2;
           var wint = (screen.height - h) / 2;
           winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrollbar ;
		   win = window.open(url, windowName, winprops);
           if (parseInt(navigator.appVersion) >= 4) { 
              	win.window.focus(); 
           } 
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

function sendToFlash () {
	var txt = document.getElementById("inputField").value;
	var txtBold = document.getElementById("txtBold").value;
	var txtItalic = document.getElementById("txtItalic").value;
	var txtColor = document.getElementById("txtColor").value;
	var txtFont = document.getElementById("ls_font").value;
	var txtSize = document.getElementById("ls_size").value;
	getobj('NDKPhoto').sendText(txt,txtFont,txtColor,txtSize,txtBold,txtItalic);
	return false;
}

function ChangeFrame (url) {
	getobj('NDKPhoto').sendFrame(url);
}

function ChangeClipart (url) {
	getobj('NDKPhoto').sendClipart(url);
}

function updateFile(outFile) {
	furl = 'act:savecam|url:'+outFile;
	sendReq('index.php', 'cmd', furl,'cam_result');
	showobj('cam_result');
}

function Show_Select_Color() {
	var newcolor = showModalDialog("select_color.html", "000000", "resizable: no; help: no; status: no; scroll: no; unadorned: no; dialogLeft:400; dialogTop:500;");
    if (newcolor != null) {
		document.getElementById("txtColor").value = newcolor; 
		document.getElementById("cl_pick").src = "pick_color.php?c="+newcolor;
		sendToFlash();
	}
}

function Dao_Gia_Tri(obj) {
	var num = document.getElementById(obj).value;
	if (num!=1) document.getElementById(obj).value = 1;
	else document.getElementById(obj).value = 0;
	sendToFlash();
}

function gotopage(p,cat){  
	change_frame_page(p,cat);
}

function change_frame_page(p,cat) {
	furl = 'act:jsload|sub:frame|p:'+p+'|cat:'+cat;
	sendReq('index.php', 'cmd', furl,'displayFrame');
}

function gotopage_clip(p,cat){  
	change_clip_page(p,cat);
}

function change_clip_page(p,cat) {
	furl = 'act:jsload|sub:clip|p:'+p+'|cat:'+cat;
	sendReq('index.php', 'cmd', furl,'displayClipart');
}