Hi all, I'm relatively new to JS and I have an issue which I can't seem to get my head around...
I have a perl script which iterates through an array and populates a table with its values. Within the created table I have a link in each row which calls a js function onMouseOver(). I have tried to simplify this as much as possible.
foreach $equipment (@some_array) {
"<a href='some_script' onMouseOver=displayPanel('box'); onMouseOut=hidePanel('box');><b>$equipment</b></a>";
}
print "<span id='box' class='box' style='display: none;'>";
print "<strong><u>Host Information:</u></strong><br>";
// dynamic content to be displayed here depending on which link is hovered over
print "</span>";
These JavaScript functions hide/display the span called 'box' (elementary stuff)
function displayPanel(id) {
document.getElementById(id).style.display = 'block';
}
function hidePanel(id) {
document.getElementById(id).style.display = 'none';
}
My problem is that I want to change the content displayed in the span box depending on which link the user has his/her mouse over. So how can I set a variable that tells me which link is being hovered over?! The only thing I could think of was giving the <a>
a unique ID, but then I'd have to pass a value back to perl and this is where I start to confuse myself with the client/server-side stuff! So maybe some sort of AJAX would do the trick? Any help is much appreciated.
Regards,
ns