What it is now:
I'm working on a personal blog because I'll be visiting Sweden for 4 months. I've found / hacked a script that allows the user to mouseover swedish words and have a static translation box show the translation.
Working site at http://sverigejourney.tumblr.com
The current code I use to, say, translate "sverige" to "sweden" is:
<span id="trans">the translation will appear here</span>
<a onmouseover="document.getElementById('trans').firstChild.data = 'sweden'; return true;">sverige</a>
To be honest though I'm not exactly sure why this works. I'm not sure why it uses the <a> tags and I'm pretty sure it's javascript but I don't use an <script> coding in my html and it still works...
What I would like to do:
Because I'll be using this a lot on my page I'd like to create a function to shorten what I have to type.
Something along the lines of:
<a onmouseover="translate("sweden")">sverige</a>
But I'm really not all that experienced in javascript - anyone have any pointers? I'd really appreciate it!
-Jackson