Ver Mensaje Individual
  #86 (permalink)  
Antiguo 23/05/2006, 10:42
Avatar de sumolari
sumolari
 
Fecha de Ingreso: mayo-2006
Ubicación: localhost
Mensajes: 1.367
Antigüedad: 18 años
Puntos: 18
Pregunta El error es persistente

Hola de nuevo:
He probado de nuevo con el generador. Esta vez no he tenido ningún error de mamoria ni nada. He copiado el código que habia en el cuadro de texto y lo he pegado. El frontpage me ha dado este error:
Código:
Line 61
Error: 'marco.document' no es un objeto o es nulo
. He tenid este error en las linias 332 y 319. Después he visto el resultado en el IE y he visto tres palabras separadas por un par de espacios. ¿Qué pasa?
Les pongo el código si lo quieren ver:
Código:
var anchoOp = 100
var menuPrin = 2
var Fram = 'menu'
posicion = 'bottom' //si se quiere que el menú principal esté pegado a la parte inferior de la página
centrado = true //true si se quiere centrado el menú principal

function seccion(tex,enl,dstn,subO,an,dir){
this.tex = tex
this.enl = enl
this.dstn = dstn
this.subO = subO
this.dir = dir
this.an = an
}
Quito la parte "configurable"
Código:
	
var marco=eval('parent.'+Fram);
var tunIex=navigator.appName=="Microsoft Internet Explorer"?true:false;
var tiempo
function menucete(ide,num){ // crea submenus principales (capa)
espan = marco.document.createElement("span")
marco.document.getElementById('Men_'+num).appendChild(espan)
espan.id=ide.toLowerCase(ide)+'_'+num
espan.className="subMe"
espan.cierra = true
espan.tiempo = 0
espan.onmouseout=function(){
	setTimeout('ocultaP()',1000)
	}
with(espan.style){
	width = anchoOp+"px"
	}
construye(ide+'_'+num,eval('Op_'+num).subO)
}
function menPrin(){ //crea menu principal
hojaEstilos = marco.document.createElement('link')
hojaEstilos.href='menudesp.css'
hojaEstilos.rel='stylesheet'
hojaEstilos.type='text/css'
marco.document.documentElement.firstChild.appendChild(hojaEstilos)
menuP=marco.document.createElement('div')
if(!tunIex){
tablaP = marco.document.createElement('table')
menuP.appendChild(tablaP)
fila=marco.document.createElement('tr')
fila.id ='filita'
tablaP.appendChild(fila)
if(centrado && !tunIex){
tablaP.style.marginLeft='auto'
tablaP.style.marginRight='auto'
}
tablaP.cellSpacing='0'
tablaP.className='celda'
}
marco.document.body.appendChild(menuP)
menuP.className = "subMeP"
menuP.id = 'MenuPrincipal'
menuP.style.visibility='hidden'
menuP.style.position='absolute'
menuP.style.top= '-5px'
for(s=0; s<menuPrin; s++){ //crea botones principales
	if(!tunIex){opcionP=marco.document.createElement('div')}
	else{opcionP=marco.document.createElement('span')}
	opcionP.className = "botonesP"
	opcionP.style.width= anchoOp+'px'
	marco.document.getElementById('MenuPrincipal').appendChild(opcionP)
	opcionP.id='Men_'+s
	opcionP.onclick=function(){
		}
	if(!tunIex){
	celda = marco.document.createElement('td')
	marco.document.getElementById('filita').appendChild(celda)
	celda.id='celda_' + s
	celda.appendChild(opcionP)
	celda.className='celda'
	}
	if(eval('Op_'+s).subO > 0){
	menucete('Op',s)
	}
}
if(centrado && tunIex){
	 centra()
	}
}
var subs=new Array(0)
function construye(ide,num){
subOp=0
for(m=0; m<num; m++){
	opchon = eval(ide +'_' + m)
	caja = marco.document.createElement("div")
	boton = marco.document.createElement("div")
	boton.appendChild(caja)
	caja.className='Caj'
	marco.document.getElementById(ide.toLowerCase()).appendChild(boton)
	identi = ide.toLowerCase()  + "_" + m
	caja.id=identi+'caja'
	boton.id = identi
	boton.className = 'botones'
	marco.document.getElementById(identi).appendChild(marco.document.createTextNode(opchon.tex))
	salto = marco.document.createElement('br')
	boton.onmouseover=function(){
		this.className='botonesHover'
		this.parentNode.cierra=false
		muestra(this.parentNode.id)
		}
	boton.onmouseout=function(){
		this.className='botones'
		this.parentNode.cierra = true
		}
	if(opchon.subO > 0){
		subs[subs.length] = identi
		subOp++
		boton.style.cursor='default'
		}
	else{
		boton.style.cursor=cur
		if(opchon.enl!=null){
			boton.enl=opchon.enl
			boton.dstn=opchon.dstn
			boton.onclick=function(){
			enlaces(this.enl,this.dstn)
				}
			}
		}
	
}	
	if(subs.length>0){construyeSub(subs)}
}
function construye2(ide,num){
for(m=0; m<num; m++){
	opchon = eval(ide +'_' + m)
	caja = marco.document.createElement("div")
	boton = marco.document.createElement("div")
	boton.appendChild(caja)
	caja.className='Caj'
	marco.document.getElementById(ide.toLowerCase()+'_sub').appendChild(boton)
	identi = ide.toLowerCase()  + "_" + m
	boton.id = identi
	caja.id=identi+'caja'
	boton.className = 'botones'
	marco.document.getElementById(identi).appendChild(marco.document.createTextNode(opchon.tex))
	salto = marco.document.createElement('br')
	boton.onmouseover=function(){this.className='botonesHover'}
	boton.onmouseout=function(){this.className='botones'}
	if(opchon.subO > 0){
		subs[subs.length] = identi
		subOp++
		boton.style.cursor='default'
		}
	else{
		boton.style.cursor=cur
		if(opchon.enl!=null){
			boton.enl=opchon.enl
			boton.dstn=opchon.dstn
			boton.onclick=function(){
			enlaces(this.enl,this.dstn)
				}
			}
		}
	}	
}
var cur=tunIex?'hand':'pointer'
function construyeSub(lista){
largo = subs.length
for(t=0; t<subs.length;t++){
if(subs[t] != null){
	obj = subs[t].charAt(0).toUpperCase() + subs[t].substr(1)
	espan = marco.document.createElement("span")
	marco.document.getElementById(subs[t]+'caja').appendChild(espan)
	espan.id=subs[t]+'_sub'
	espan.className="subMe"
	espan.cierra = true
	marco.document.getElementById(subs[t]).onmouseover=function(){
	this.className = 'botonesHover'
	this.parentNode.cierra=false
	muestra(this.id+'_sub')
	}
	marco.document.getElementById(subs[t]).onmouseout=function(){
		this.className = 'botones'
		this.parentNode.cierra = true
		oculta(this.id+'_sub')
		}
	espan.onclick=function(){
		}
		if(eval(obj).an){An=eval(obj).an}
		else{An=anchoOp}
		if(eval(obj).dir=='iz')
		{pIz=-(An-20)+"px"}
		else{pIz=(An-20)+"px";}
	with(espan.style){
	position="absolute"
	width = An+"px"
	left= pIz
	if(!tunIex){top='-10px'}
	visibility = 'hidden'
	}
	construye2(obj,eval(obj).subO)
	subs[t] = null
	}
	}
}
function enlaces(enl,dstn){
if(dstn.toLowerCase() == 'nueva'){
	window.open(enl)
	}
else if(dstn==null){
	top.location.href=enl
	}
else{
	eval('parent.' + dstn+".location.href='"+enl+"'")
	}
}
function muestra(cual){
marco.document.getElementById(cual).style.visibility='visible'
}
function oculta(cual){
marco.document.getElementById(cual).style.visibility='hidden'
}
function ocultaP(){
for(y=0;y < menuPrin;y++){
if(marco.document.getElementById('op_'+y)!=null){
	if(marco.document.getElementById('op_'+y).cierra){
	marco.document.getElementById('op_'+y).style.visibility='hidden'
	}
	}
	}
}
var reaj=0
function centra(){
anM=(anchoOp*menuPrin)+(4*menuPrin)+reaj
posCentra =anM/2
document.getElementById('MenuPrincipalP').style.width=anM+'px'
marco.document.getElementById('MenuPrincipal').style.width=anM+'px'
document.getElementById('MenuPrincipalP').style.left='50%'
marco.document.getElementById('MenuPrincipal').style.left='50%'
document.getElementById('MenuPrincipalP').style.marginLeft=-posCentra
marco.document.getElementById('MenuPrincipal').style.marginLeft=-posCentra
reAjusta()
}
function reAjusta(){
if((document.getElementById('tuMen0').scrollHeight*2)< document.getElementById('MenuPrincipalP').scrollHeight){reaj+=2; centra()}
}
function inicio(){
////////////////////////////////////////////
menuP=document.createElement('div')
if(!tunIex){
tablaP = document.createElement('table')
menuP.appendChild(tablaP)
fila=document.createElement('tr')
fila.id ='filitaP'
tablaP.appendChild(fila)
if(centrado && !tunIex){
tablaP.style.marginLeft='auto'
tablaP.style.marginRight='auto'
}
tablaP.cellSpacing='0'
tablaP.className='celda'
}
document.body.appendChild(menuP)
menuP.className = "subMeP"
menuP.id = 'MenuPrincipalP'
if(posicion=='bottom'){
menuP.style.position='absolute'
menuP.style.bottom='0'
}
for(s=0;s < menuPrin; s++){ //crea botones principales
	if(!tunIex){opcionP=document.createElement('div')}
	else{opcionP=document.createElement('span')}
	opcionP.className = "botones"
	opcionP.style.width= anchoOp+'px'
	if(eval('Op_'+s).subO==0){
		opcionP.hijos = false
		opcionP.style.cursor=cur
		}
	else{opcionP.hijos=true;opcionP.style.cursor='default'}
	opcionP.appendChild(document.createTextNode(eval('Op_'+s).tex))
	document.getElementById('MenuPrincipalP').appendChild(opcionP)
	opcionP.id='tuMen'+s
	opcionP.enl=eval('Op_'+s).enl
	opcionP.dstn=eval('Op_'+s).dstn
	opcionP.onclick=function(){
		}
	if(!tunIex){
	celda = document.createElement('td')
	document.getElementById('filitaP').appendChild(celda)
	celda.id='celdaP_' + s
	celda.appendChild(opcionP)
	celda.className='celda'
	}
}
////////////////////////////////////////////
for(n=0;n<menuPrin;n++){
document.getElementById('tuMen'+n).onmouseover=function(){
	if(marco.document.getElementById('op_'+this.id.substr(5))==null && this.hijos==true){menPrin()}
	if(marco.document.getElementById('op_'+this.id.substr(5))!=null){
		clearTimeout(tiempo)
		marco.document.getElementById('op_'+this.id.substr(5)).cierra=false
		ocultaP()
		muestra('op_'+this.id.substr(5))
		}
	else{
		clearTimeout(tiempo)
		ocultaP()
		}
	}
document.getElementById('tuMen'+n).onmouseout=function(){
if(marco.document.getElementById('op_'+this.id.substr(5))!=null){
		marco.document.getElementById('op_'+this.id.substr(5)).cierra=true
		tiempo =setTimeout('ocultaP()',1000)
		}
	}
if(eval('Op_'+n).subO==0 && eval('Op_'+n).enl!=null){
	document.getElementById('tuMen'+n).onclick=function(){
		enlaces(this.enl,this.dstn)
		}
	}
}
menPrin()
}
window.onload=inicio
//******** fin de no tocar *****************
</script>