Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
txp:section and JavaScript innerHTML
I have this
<li><txp:section name="kontakt" title="1">Kontakt</txp:section></li>
which generates the
<a title="Ako želite da nas kontaktirate, ovo je pravo mesto za to" href="http://krajemnaseulice.com/jm/kontakt/">Kontakt</a>
I need to make it
<a title="Ako želite da nas kontaktirate, ovo je pravo mesto za to" href="http://krajemnaseulice.com/jm/kontakt/" onmouseover="document.getElementById('tip').innerHTML = 'Ako želite da nas kontaktirate, ovo je pravo mesto za to';" onmouseout="document.getElementById('tip').innerHTML = ' ';"">Kontakt</a>
But when I add the JavaScript code into the txp:sections like this
<li><txp:section name="kontakt" title="1" onmouseover="document.getElementById('tip').innerHTML = 'Ako želite da nas kontaktirate, ovo je pravo mesto za to';" onmouseout="document.getElementById('tip').innerHTML = ' ';"">Kontakt</txp:section></li>
I get an error. Paring wrong.
How can I make this work?
(Edited to display code properly. (How do I post tags and code on the forum?) -Els)
Last edited by els (2008-04-07 19:03:14)
“… they were enterprising voyages…” – Mr. Spock ( from Spock vs. Q )
Offline
Re: txp:section and JavaScript innerHTML
In your example you don’t need javascript:
Try using this:
<style>
a span {
display: none
}
a:hover span {
display: block
}
</style>
and:
<li><txp:section name=“kontakt” title=“1”>Kontakt<span>Ako želite da nas kontaktirate, ovo je pravo mesto za to</span></txp:section></li>
Digital nomad, sailing the world on a sailboat: 32fthome.com
Offline
Re: txp:section and JavaScript innerHTML
Thanks for help, but you missunderstood me.
The JavaScript is displaying text in another div that has ID ‘tip’, I need it to be like that. Is there some help with this?
“… they were enterprising voyages…” – Mr. Spock ( from Spock vs. Q )
Offline
#4 2008-04-07 19:16:21
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: txp:section and JavaScript innerHTML
<txp:section />
doesn’t have attributes like onmouseover
and onmouseout
.
Besides hardcoding the entire link, you could do this:
<a title="<txp:section name="kontakt" title="1" />" href="<txp:site_url /><txp:section name="kontakt" />/" onmouseover="document.getElementById('tip').innerHTML = 'Ako želite da nas kontaktirate, ovo je pravo mesto za to';" onmouseout="document.getElementById('tip').innerHTML = ' ';">Kontakt</a>
Offline
Re: txp:section and JavaScript innerHTML
Els your are the man! :D
This worked perfectly! :)
“… they were enterprising voyages…” – Mr. Spock ( from Spock vs. Q )
Offline
Pages: 1