Hello all, i’m totally new to JS so i’ve a problem:
I’m trying to develop a plugin for comments: when mouse is over the commenter’s name it take a screenshot of his website with a rollover effect.
All works fine if there is just one comment, but none good when the comments are 2 or plus.
Basically i load this JS in the header
<script type="text/javascript">
function MOver(picimage)
{
Picture_Over = eval(picimage +"On.src")
document[picimage].src = Picture_Over
}
function MOut(picimage)
{
Picture_Out = eval(picimage +"Off.src")
document[picimage].src = Picture_Out
}
-->
</script>
Then this is the code to turn the screenshot on:
<script type="text/javascript"><!--
var Img2On = new Image();
Img2On.src = "<?php echo $urlnohttp;?>";
var Img2Off = new Image();
Img2Off.src = "<?php bloginfo('url');?>/wp-content/plugins/[...]/control_play.png";
</script>
<a href="<?php echo $commenturl ?>" onMouseOver="MOver('Img2')" onMouseOut = "MOut('Img2')" ><?php echo $author ?> <img src="<?php bloginfo('url');?>/wp-content/plugins/[...]/control_play.png" border="0" name="Img2"></img></a>
I think the problem is that the name of var in MOver() is not unique, but i don’t know how to dinamically change the var name.
Thanks