jrv Posted June 6, 2008 at 03:11 PM Report Share #189788 Posted June 6, 2008 at 03:11 PM boa tarde eu tenho um mapa que é uma div e que esta dividido em varias area shape, e quero que apareça uma imagem noutra div quando passo com o rato numa área (este passo esta conseguido) e quero que apareça noutra div uma palavra também quando passo na área dentro do mapa.Alguém me consegue ajudar com alguma função? Obrigado Link to comment Share on other sites More sharing options...
vitortomaz Posted June 6, 2008 at 03:19 PM Report Share #189790 Posted June 6, 2008 at 03:19 PM não dá para usar o mesmo esquema? na função onde "metes" a imagem no div metes também o texto no outro div, não funciona assim? http://vitortomaz.blogspot.com/ Link to comment Share on other sites More sharing options...
jrv Posted June 6, 2008 at 03:28 PM Author Report Share #189792 Posted June 6, 2008 at 03:28 PM A função que estou a utilizar para por a imagem é a seguinte: function LoadGallery(image, UrlFrom){ if(typeof UrlFrom == "object" || UrlFrom == "[object]"){ document.getElementById(image).src = UrlFrom.src; } else{ document.getElementById(image).src = UrlFrom; } } como é para duas divs diferentes não sei como adaptar isto... Link to comment Share on other sites More sharing options...
vitortomaz Posted June 6, 2008 at 03:36 PM Report Share #189794 Posted June 6, 2008 at 03:36 PM o texto que queres escrever está onde? não vem como parâmetro para esta função? tipo function LoadGallery(image, UrlFrom, textoParam){ if(typeof UrlFrom == "object" || UrlFrom == "[object]"){ document.getElementById(image).src = UrlFrom.src; document.getElementById(divTexto).innerHTML = textoParam; } else{ document.getElementById(image).src = UrlFrom; } } não tenho a certeza se é innerHTML mas não é por aí... http://vitortomaz.blogspot.com/ Link to comment Share on other sites More sharing options...
jrv Posted June 6, 2008 at 03:51 PM Author Report Share #189801 Posted June 6, 2008 at 03:51 PM o texto que quero que apareça vai depender da area que esta a ser selecionada no mapa, ou seja não entra como parametro, se calhar neste caso teria que ter outra funcao??!!! Link to comment Share on other sites More sharing options...
vitortomaz Posted June 6, 2008 at 03:59 PM Report Share #189803 Posted June 6, 2008 at 03:59 PM o texto que quero que apareça vai depender da area que esta a ser selecionada no mapa, ou seja não entra como parametro, se calhar neste caso teria que ter outra funcao??!!! pois, crias uma função para ir buscar o texto (tb pode ficar dentro desta)... ideia: usar o atributo "alt" da imagem para guardar esse texto que queres apresentar, dependendo do cenário pode ser uma solução 😉 http://vitortomaz.blogspot.com/ Link to comment Share on other sites More sharing options...
jrv Posted June 6, 2008 at 04:08 PM Author Report Share #189805 Posted June 6, 2008 at 04:08 PM eu em cada area shape tenho o atributo alt com o respectivo texto, mas nao tou a ver como posso utilizar esse atributo p fazer aparecer na div. Podias-me dar uma ajuda nisso?Obrigado Link to comment Share on other sites More sharing options...
vitortomaz Posted June 6, 2008 at 04:43 PM Report Share #189812 Posted June 6, 2008 at 04:43 PM qq coisa do género (sem testar) var texto = getElementById(imagem).alt http://vitortomaz.blogspot.com/ Link to comment Share on other sites More sharing options...
jrv Posted June 6, 2008 at 10:43 PM Author Report Share #189887 Posted June 6, 2008 at 10:43 PM ja tentei dessa forma,mas nao estou a conseguir chamar da mellhor forma... onmouseover="LoadGallery('ola',teste.png',??????????); var texto = getElementById(descricao).alt function LoadGallery(image, UrlFrom, texto){ if(typeof UrlFrom == "object" || UrlFrom == "[object]"){ document.getElementById(image).src = UrlFrom.src; document.getElementById(descricao).innerHTML = texto; } else{ document.getElementById(image).src = UrlFrom; } } Link to comment Share on other sites More sharing options...
vitortomaz Posted June 6, 2008 at 11:42 PM Report Share #189897 Posted June 6, 2008 at 11:42 PM var texto = getElementById(descricao).alt [falta o document tipo document.getElement...] este código está a funcionar no FF3, IE8 e Opera <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Page</title> <script type="text/javascript"> function LoadGallery() { var txt = document.getElementById("dass").alt; document.getElementById("div2").innerHTML = txt; } </script> </head> <body> <p id="aa" onmouseover="LoadGallery()">blaaaaa</p> <br /> <br /> <img id="dass" name="dass" src="" alt="alt da imagem" /> <br /> <br /> <p id="div2" onmouseover="LoadGallery()"></p> </body> </html> http://vitortomaz.blogspot.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now