[html puro] - Comando para link [RESOLVIDO]

6 respostas
lina

Oi,

Estou fazendo um “favor” para meu amigo e estou desenvolvendo um site em html. (Só html).

Faz um tempo que não utilizo isso e estou tendo problemas para colocar ação em meus botões =)

estou fazendo o seguinte:

<A href="http://site/empresa.html" class="link_rodape"> <IMG height=39 src="http://site/fontes/side_arquivos/empresa.jpg" width=188 border=0><BR> </A>

Ou seja, estou na pagina principal (index.html) e quando clico no botão empresa, ele deveria redirecionar
e pegar empresa.html.

Só que isso não está acontecendo… Estou errando em alguma coisa?

Tchauzin!

6 Respostas

rmendes08

Use o endereço relativo do objeto a ser linkado. Por exemplo, se você tem essa estrutura no site:

|- mySite
   |- index.html
   |- empresa.html
   |- img
        |- empresa_picture.jpg

Referencie apenas:

<a href="empresa.html"><img src="img/empresa_picture.jpg"</img></a>
lina

Oi,

Vou fazer o teste… depois postarei o resultado…

Obrigada.

Tchauzin!

lina

Oi,

Mesma coisa...
Vou explicar como está funcionando:

O meu index.html (principal) está assim:

<FRAMESET border=0 frameSpacing=0 frameBorder=0 cols=187,*>
   <FRAME name=side marginWidth=0 marginHeight=50 src="side.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0">
    <FRAMESET border=0 rows=96,* frameBorder=0><FRAME name=top marginWidth=0 marginHeight=0 src="top.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0">
    <FRAME name=main marginWidth=0 marginHeight=0 src="main.html" frameBorder=no noResize leftmargin="0" topmargin="0">	
</FRAMESET>

Ou seja, estou motando o side.html que é onde fica os meus botões, depois estou montando o top.html que é o meu topo e por fim o main.html que é onde ficam os textos do site.

Na classe side.html está assim:

<A href="empresa.html">
   <IMG height=39 src="empresa.jpg" width=188 border=0><BR>	
</A>

Quando eu clico no botão EMPRESA, ele irá abrir esse empresa.html.
Neste empresa.html é uma copia do index.html porém no lugar de chamar o main.html eu estou chamado o mainEmpresa.html que fica o texto da parte da empresa:

<FRAMESET border=0 frameSpacing=0 frameBorder=0 cols=187,*>
   <FRAME name=side marginWidth=0 marginHeight=50 src="side.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0">
    <FRAMESET border=0 rows=96,* frameBorder=0><FRAME name=top marginWidth=0 marginHeight=0 src="top.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0">
    <FRAME name=main marginWidth=0 marginHeight=0 src="mainEmpresa.html" frameBorder=no noResize leftmargin="0" topmargin="0">	
</FRAMESET>

Só que isso não funciona... ele simplesmente continua no index.html

Obs: Se eu chamar diretamente na ação do botão a classe mainEmpresa.html:

<A href="mainEmpresa.html">
   <IMG height=39 src="empresa.jpg" width=188 border=0><BR>	
</A>

Ele funciona, porém não no local correto! ele sobreescreve o meu side.html.

Tchauzin!

wbdsjunior

oi lina.

primeiro, acho que faltou fechar um frameset.

&lt;FRAMESET border=0 frameSpacing=0 frameBorder=0 cols=187,*&gt; &lt;FRAME name=side marginWidth=0 marginHeight=50 src="side.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0"&gt; &lt;FRAMESET border=0 rows=96,* frameBorder=0&gt; &lt;FRAME name=top marginWidth=0 marginHeight=0 src="top.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0"&gt; &lt;FRAME name=main marginWidth=0 marginHeight=0 src="main.html" frameBorder=no noResize leftmargin="0" topmargin="0"&gt; &lt;/FRAMESET&gt; &lt;!-- aqui --&gt; &lt;/FRAMESET&gt;
segundo, você não precisa ter um empresa.html quase identico a index.html. tente colocar o atributo target no link.

&lt;A href="mainEmpresa.html" target="main"&gt; &lt;IMG height=39 src="empresa.jpg" width=188 border=0&gt;&lt;BR&gt; &lt;/A&gt;

wbdsjunior

um exemplo do que disse anteriormente:

index.html

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;HTML&gt; &lt;HEAD&gt; &lt;TITLE&gt;Test&lt;/TITLE&gt; &lt;/HEAD&gt; &lt;FRAMESET border=0 frameSpacing=0 frameBorder=0 cols=187,*&gt; &lt;FRAME name=side marginWidth=0 marginHeight=50 src="side.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0"&gt; &lt;FRAMESET border=0 rows=96,* frameBorder=0&gt; &lt;FRAME name=top marginWidth=0 marginHeight=0 src="top.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0"&gt; &lt;FRAME name=main marginWidth=0 marginHeight=0 src="main.html" frameBorder=no noResize leftmargin="0" topmargin="0"&gt; &lt;/FRAMESET&gt; &lt;/FRAMESET&gt; &lt;/HTML&gt;
top.html

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;HTML&gt; &lt;BODY&gt; &lt;H1&gt;Top&lt;/H1&gt; &lt;/BODY&gt; &lt;/HTML&gt;
side.html

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;HTML&gt; &lt;BODY&gt; &lt;H2&gt;Side&lt;/H2&gt; &lt;A href="mainEmpresa.html" target="main"&gt;Empresa&lt;/A&gt; &lt;/BODY&gt; &lt;/HTML&gt;
main.html

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;HTML&gt; &lt;BODY&gt; &lt;H2&gt;Main&lt;/H2&gt; &lt;/BODY&gt; &lt;/HTML&gt;
mainEmpresa.html

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;HTML&gt; &lt;BODY&gt; &lt;H2&gt;Main Empresa&lt;/H2&gt; &lt;/BODY&gt; &lt;/HTML&gt;

lina

oi lina.

primeiro, acho que faltou fechar um frameset.

&lt;FRAMESET border=0 frameSpacing=0 frameBorder=0 cols=187,*&gt; &lt;FRAME name=side marginWidth=0 marginHeight=50 src="side.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0"&gt; &lt;FRAMESET border=0 rows=96,* frameBorder=0&gt; &lt;FRAME name=top marginWidth=0 marginHeight=0 src="top.html" frameBorder=no noResize scrolling=no leftmargin="0" topmargin="0"&gt; &lt;FRAME name=main marginWidth=0 marginHeight=0 src="main.html" frameBorder=no noResize leftmargin="0" topmargin="0"&gt; &lt;/FRAMESET&gt; &lt;!-- aqui --&gt; &lt;/FRAMESET&gt;

Oi,

o frameset já estava fechado…


segundo, você não precisa ter um empresa.html quase identico a index.html. tente colocar o atributo target no link.

&lt;A href="mainEmpresa.html" target="main"&gt; &lt;IMG height=39 src="empresa.jpg" width=188 border=0&gt;&lt;BR&gt; &lt;/A&gt;

Realmente o target foi a solução!! Tinha me esquecido desta função… Agora está funcionando.

Obrigada.

Tchauzin!

Criado 15 de outubro de 2009
Ultima resposta 15 de out. de 2009
Respostas 6
Participantes 3