Foros del Web » Programando para Internet » Javascript »

problemilla con capas

Estas en el tema de problemilla con capas en el foro de Javascript en Foros del Web. Hola, resulta que tengo dos script de javascript en mi pagina que trabajan para dos cosas distintas, pero ambas con capas, el primero es para ...
  #1 (permalink)  
Antiguo 01/03/2003, 08:10
 
Fecha de Ingreso: mayo-2002
Mensajes: 197
Antigüedad: 22 años
Puntos: 0
problemilla con capas

Hola, resulta que tengo dos script de javascript en mi pagina que trabajan para dos cosas distintas, pero ambas con capas, el primero es para un menu despregable y el segundo es para un scroll de noticias, los dos son del programa ScriptMaster, ya que yo no se javascript.

Mi problema es que por separado funcionan bien, pero cuando los junto solo funciona el que ponga en ultimo lugar, supongo que porque al mostrarse el de las noticias por ejemplo, hace que se oculten las capas del menu.

Si pudierais echarle un vistazo y comentarme como hacer que se vean a la vez ambos os estaria ETERNAMENTE AGRADECIDO, ya que yo le estoy dando muchas vueltas pero nada.

Los scripts son los siguientes:


<style type="text/css">
#divFoldCont {position:absolute; left:2px; top:240px; width:170px; visibility:hidden;}
.clFold {position:absolute; width:170px;}
.clFoldSub {position:absolute; left:10px; width:170px; visibility:hidden;}
.clFoldSub2 {position:absolute; left:10px; width:170px; visibility:hidden;}
.clFoldLinks {font-family:Arial, Verdana, Helvetica, Helv; font-size:13px; font-weight:bold; text-decoration:none; color:black;}
.clSubLinks {font-family:Arial, Verdana, Helvetica, Helv; font-size:12px; text-decoration:none; color:black;}
.clSubLinks2 {font-family:Arial, Verdana, Helvetica, Helv; font-size:11px; text-decoration:none; color:black;}
</style>


<script language="JavaScript" type="text/javascript">

function lib_bwcheck(){ //Browsercheck (needed)
this.ver=navigator.appVersion
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
this.ie=this.ie4||this.ie5||this.ie6
this.mac=this.agent.indexOf("Mac")>-1
this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
return this
}
var bw=lib_bwcheck()

if(document.layers){ //NS4 resize fix...
scrX= innerWidth; scrY= innerHeight;
onresize= function(){if(scrX!= innerWidth || scrY!= innerHeight){history.go(0)} }
}

if(navigator.userAgent.indexOf('Opera')>-1 && document.getElementById){ //Opera 5 resize fix.
scrX= innerWidth; scrY= innerHeight;
document.onmousemove= function(){
if(scrX<innerWidth-10 || scrY<innerHeight-10 || scrX>innerWidth+10 || scrY>innerHeight+10){
scrX = innerWidth;
scrY = innerHeight;
foldInit();
}
};
}

//Do you want images (if not set to 0 and remove the images from the body)?
foldImg=1

//Here are the images for the top links.
foldinImg=new Image(); foldinImg.src="imagenes/menu/foldoutmenu2_arrow.gif" //The image for the closed state.
foldoutImg=new Image(); foldoutImg.src="imagenes/menu/foldoutmenu2_arrow_open.gif" //The image for the open state.
//Here are the images for the sub links.
foldsubinImg=new Image(); foldsubinImg.src="imagenes/menu/foldoutmenu2_arrow.gif" //The image for the "in" state.
foldsuboutImg=new Image(); foldsuboutImg.src="imagenes/menu/foldoutmenu2_arrow_open.gif" //The image for the "out" state.
//If you change the images above please remember to change the images in the actual page as well.

mainmenus=12 //How many main menus do you have?

//How many submenus do you have beneath each main level.
submenus=new Array(0,0,0,3,4,2,3,4,5,0,0,0)
//In this example I have 3 submenus in the first top menu,
//3, in the second, 2 submenus in the third top menu and 3 in the forth.
//It's really important that these numbers are correct.

pxbetweenmain = 10 //How much space should there be between the main menus
pxbetweensub = 5 //How much space should there be between the sub menus

mainstayfolded = false //Should the main menus stay folded?
substayfolded = false //Should the sub menus stay folded? Play with these 2 variables.

function makeMenu(obj,nest){
nest=(!nest) ? "":'document.'+nest+'.';
this.css= bw.dom? document.getElementById(obj).style:bw.ie4?document .all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;
this.elm= bw.dom?document.getElementById(obj):bw.ie4?documen t.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
this.ref= bw.dom || bw.ie4? document:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;
this.x= bw.ns4?this.css.left:bw.opera5?this.css.pixelLeft: this.elm.offsetLeft;
this.y= bw.ns4?this.css.top:bw.opera5?this.css.pixelTop:th is.elm.offsetTop;
this.height= bw.ns4?this.ref.height:bw.opera5?this.css.pixelHei ght:this.elm.offsetHeight;
this.hideIt= b_hideIt;
this.showIt= b_showIt;
this.moveIt= b_moveIt;
this.status= 0;
return this;
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_showIt(){this.css.visibility="visible"; this.status=1}
function b_hideIt(){this.css.visibility="hidden"; this.status=0}
function b_moveIt(x,y){this.x=x; this.y=y; /*this.css.left=this.x+px;*/ this.css.top=this.y+px;}
/************************************************** **********************************
Initiating the page and making the menu
************************************************** **********************************/
function foldInit(){
//Fixing the browsercheck for opera... this can be removed if the browsercheck has been updated!!
bw.opera5 = (navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?true:false
if (bw.opera5) bw.ns6 = 0

//Creating the foldoutmenu
oFold = new Array();
y = 0;
for (var i=0; i<mainmenus; i++){
oFold[i] = new makeMenu('divFold'+i,'divFoldCont');
oFold[i].moveIt(0,y);
oFold[i].size = oFold[i].height;
y += oFold[i].height+pxbetweenmain;
if (bw.ns4) oFold[i].css.clip.bottom = 500;
oFold[i].sub = new Array();
oFold[i].subs = top_subs;
suby = oFold[i].height+pxbetweensub;
for (var j=0; j<submenus[i]; j++){
oFold[i].sub[j] = new makeMenu('divFoldSub'+i+'_'+j,'divFoldCont.documen t.divFold'+i);
oFold[i].sub[j].sub = new makeMenu('divFoldSub'+i+'_'+j+'_0','divFoldCont.do cument.divFold'+i+'.document.divFoldSub'+i+'_'+j);
oFold[i].sub[j].hideIt();
oFold[i].sub[j].sub.hideIt();
oFold[i].sub[j].moveIt(10,suby);
suby += oFold[i].sub[j].height+pxbetweensub;
}
}
oFoldCont = new makeMenu('divFoldCont');
if (bw.ns4) oFoldCont.css.clip.bottom = 800;
oFoldCont.showIt(); //Showing the menu when the menu have been "created"
}
/************************************************** **********************************
Object function to the top of the menus.
************************************************** **********************************/
function top_subs(show, num){
for (var j=0; j<this.sub.length; j++){
if (show){
this.sub[j].showIt()
if (foldImg) this.ref["imgFold"+num].src = foldoutImg.src
if (substayfolded){if(this.sub[j].sub.status) this.sub[j].sub.showIt()
}else{
if (foldImg) this.sub[j].ref["imgFold"+num+"Sub"+j].src = foldsubinImg.src
this.sub[j].sub.hideIt()
}
}else{
this.sub[j].hideIt()
if (foldImg) this.ref["imgFold"+num].src = foldinImg.src
if (!substayfolded) this.sub[j].sub.hideIt()
else if (substayfolded) this.sub[j].sub.css.visibility="hidden"
}
}
}

..............


</script>

<style type="text/css">
#divNewsCont{position:absolute; width:100%; height:500; overflow:hidden; top:710; left:220; clip:rect(0,350,212,0); visibility:hidden}
#divNewsText{position:absolute; top:0; left:0}
</style>

<script language="JavaScript" type="text/javascript">

lstart=212
loop=true
// Velocidad
speed=25
pr_step=1

function makeObj(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.el=bw.dom?document.getElementById(obj):bw.ie4 ?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
this.css=bw.dom?document.getElementById(obj).style :bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
this.scrollHeight=bw.ns4?this.css.document.height: this.el.offsetHeight
this.newsScroll=newsScroll;
this.moverIt=b_moverIt; this.x; this.y;
this.obj = obj + "Object"
eval(this.obj + "=this")
return this
}
function b_moverIt(x,y){
this.x=x;this.y=y
this.css.left=this.x
this.css.top=this.y
}
function newsScroll(speed){
if(this.y>-this.scrollHeight){
this.moverIt(0,this.y-pr_step)
setTimeout(this.obj+".newsScroll("+speed+")",speed )
}else if(loop) {
this.moverIt(0,lstart)
eval(this.obj+".newsScroll("+speed+")")
}
}
function newsScrollInit(){
oNewsCont=new makeObj('divNewsCont')
oNewsScroll=new makeObj('divNewsText','divNewsCont')
oNewsScroll.moverIt(0,lstart)
oNewsCont.css.visibility='visible'
oNewsScroll.newsScroll(speed)
}
onload=newsScrollInit;
</script>



========================================

Muchas gracias y un saludo.
  #2 (permalink)  
Antiguo 01/03/2003, 09:04
 
Fecha de Ingreso: mayo-2002
Mensajes: 197
Antigüedad: 22 años
Puntos: 0
Ya lo tengo solucionado, no se javascript, pero cabezon como yo solo.

Un saludo peña.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:45.