Ir para conteúdo
Fórum Script Brasil
  • 0

Dúvidas Com Menu Java Script


Nands

Pergunta

Olá amigos! Estou desenvolvendo um site que utiliza frames, e eu gostaria de saber como faço para abrir um .html no "mainFrame" e outro .html no "topFrame" simultanamente, a partir de um menu em Java Script.

Segue o código do menu:

<html>

<head>

<title>Heureca - Engenharia Consultiva. Treinamentos e Palestras sobre Criatividade e Inovação.</title>

<style>

#main_panel

{

border:1px solid darkblue;

position:relative;

overflow:hidden;

}

.head_item

{

background-color:gold;

font-size:12px;

font-family:verdana;

font:bold;

border-top:1px solid darkblue;

border-bottom:1px solid darkblue;

position:absolute;

left:0px;

cursor:hand;

text-align:left;

}

.item

{

background-color:white;

font-family:verdana;

font-size:11px;

left:0px;

position:relative;

text-align:left;

}

.item_panel

{

position:absolute;

background-color:white;

left:0px;

}

.item_panel a

{

text-decoration:none;

color:black;

cursor:hand;

}

</style>

<script language="JavaScript" src="outlook.js"></script>

<script language="JavaScript">

var Link = new Array();

Link[0] = "0|Conheça a Heureca";

Link[1] = "1|Nossa História|historia.htm|mainFrame"

Link[2] = "1|Consultor|consultor.htm|mainFrame";

Link[3] = "1|Área de Atuação|atuacao.htm|mainFrame";

Link[4] = "1|Diferenciais|diferenciais.htm|mainFrame";

Link[5] = "0|Treinamentos";

Link[6] = "1|Cursos|cursos.htm|mainFrame";

Link[7] = "1|Palestras|palestras.htm|mainFrame"

Link[8] = "1|Sob Encomenda|encomenda.htm|mainFrame"

Link[9] = "0|Consultoria";

Link[10] = "1|Engenharia Industrial|engenharia.htm|mainFrame";

Link[11] = "1|Novos Produtos|produtos.htm|mainFrame";

Link[12] = "1|Internet|internet.htm|mainFrame";

Link[13] = "0|Feedback";

Link[14] = "1|Clientes|clientes.htm|mainFrame";

Link[15] = "1|Depoimentos|depoimentos.htm|mainFrame";

Link[16] = "1|Resultados|resultados.htm|mainFrame";

Link[17] = "0|Diversos";

Link[18] = "1|Heureca ou eureca?|heureca.htm|mainFrame";

Link[19] = "1|Pensamentos|pensamentos.htm|mainFrame";

Link[20] = "1|Links Interessantes|links.htm|mainFrame";

Link[21] = "1|Descobrindo os QIs|descobrindo.htm|mainFrame";

Link[22] = "0|Contato";

Link[23] = "1|Formulário|formulario.htm|mainFrame";

Link[24] = "1|Telefone/Fax|telefone.htm|mainFrame";

Link[25] = "1|Correspondência|correspondencia.htm|mainFrame";

start(3);

</script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body bgcolor="#EFEFEF">

<p>&nbsp;</p>

<p>&nbsp;</p>

</body>

</html>

-------------------------------------------------------------------------------------

var height = 180;

var vwidth = 150;

var speed = 0;

var step =2;

var hheight = 20; // heigth of a header item

var iheight = 15; // heigth of a item

var bgc = "white" // background color of the item

var tc = "black" // text color of the item

var textdec = "none";

var over_bgc = "lightyellow";

var over_tc = "red";

var over_textdec = "none"; // underline

var open = -1;

var N = (document.all) ? 0 : 1;

var Link_count = 0;

var ntop = 0;

var items = false

var z = 0;

var hnr = 1;

var timerID = null;

var link_array = new Array();

function write_menu()

{

document.write("<div id=main_panel style='height:")

if (N) document.write(height);

else document.write(height-2);

document.write(";width:");

if (N) document.write(vwidth)

else document.write(vwidth-2)

document.write("'>");

cl =0;

for(i=0;i<Link.length;i++)

{

la = Link.split("|");

if(la[0] == "0")

{

if (items == true) {document.write("</div>");items = false;}

document.write("<div class='head_item' id='move"+cl+"' style='height:"+hheight+";width:"+vwidth+";top:"+(ntop-1)+";z-index:"+z+"' onclick='move("+cl+","+hnr+")'>&nbsp;"+la[1]+"</div>");

link_array[cl] = new Array("up",0,hnr);

cl++;hnr++;

ntop += hheight-1;

z++;

}

else

{

cheight = height - ntop + 1;

if (items == false) {document.write("<div class='item_panel' id='move"+cl+"' style='height:"+cheight+"px;width:"+vwidth+";top:")

if (N) document.write(ntop+2);

else document.write(ntop);

document.write(";z-index:"+z+"'>");

z++;

link_array[cl] = new Array("up",0,"");

cl++;

}

document.write("<a href='"+la[2]+"'");

if (la[3] != "") document.write(" target='" + la[3] + "' ");

document.write(" onmouseover=color('item"+i+"') onmouseout=uncolor('item"+i+"') ><div class='item' id='item"+i+"' style='height:"+iheight+";width:"+vwidth+"'>&nbsp;&nbsp;"+la[1]+"</div></a>");

items = true;

}

}

document.write("</div>");

if (items == true) {document.write("</div>");}

}

function color(obj)

{

document.getElementById(obj).style.backgroundColor = over_bgc;

document.getElementById(obj).style.color = over_tc

document.getElementById(obj).style.textDecoration = over_textdec;

}

function uncolor(obj)

{

document.getElementById(obj).style.backgroundColor = bgc;

document.getElementById(obj).style.color = tc;

document.getElementById(obj).style.textDecoration = textdec;

}

function move(idnr,hid)

{

if ((idnr != open)&& (timerID == null))

{

if(link_array[idnr][0] == "up")

{

down = height - (hid * hheight) - ((hnr -(hid+1))* hheight) + 2;

if(N) down+=2;

dmover(idnr+2,down);

}

else

{

up = height - ((hid -1) * hheight) -((hnr - (hid))* hheight) +2;

if(N) up+=2;

umover(idnr,up);

}

open = idnr;

}

}

function dmover(idnr,down)

{

for (i=idnr;i<link_array.length;i++)

{

if(link_array[0] == "up")

{

txt_obj = "move" + i

document.getElementById(txt_obj).style.top = parseInt(document.getElementById(txt_obj).style.top) + step;

}

}

down-= step;

if(down > 0)timerID = setTimeout("dmover("+idnr+","+down+")",speed);

else

{

for (i=idnr;i<link_array.length;i++) {link_array[0] = "down";}

timerID = null;

}

}

function umover(idnr,up)

{

for (i=0;i<(idnr+2);i++)

{

if(link_array[0] == "down")

{

txt_obj = "move" + i

document.getElementById(txt_obj).style.top = parseInt(document.getElementById(txt_obj).style.top) - step;

}

}

up-=step;

if(up > 0)timerID = setTimeout("umover("+idnr+","+up+")",speed);

else

{

for (i=0;i<(idnr+2);i++) {link_array[0] = "up";}

timerID = null;

}

}

function start(idnr)

{

write_menu();

for(i=0;i<link_array.length;i++)

{

if (link_array[2] == idnr)

{

pull = i;

i = link_array.length;

}

}

}

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...