Thank you everyone for your help with my jquery problem. I now have two working pieces of code:
Code:
<div id="myselector"><a href="/joke.php"><img src="/images/joke.gif" border="0" /></a></div>
<script>
$(document).ready(function() {
$("#myselector").mouseover(function() {window.location.href = $(this).find('a').attr('href');});
});
</script>
and:
Code:
<div id="myselector"><a href="/joke.php"><img src="/images/joke.gif" border="0" /></a></div>
<script>
$( document ).ready(function() {
$("#myselector").mouseover(function( event ) {
$(this).find('a')[0].click();
});
});
</script>
Which fires the /joke.php link when the image is hovered over. But this is going to be a sitewide code for various old elements. Some, are called by javascript. And this:
Code:
<div id="myselector"><script type="text/javascript" src="/archive/humour.js"></script></div>
<script>
$( document ).ready(function() {
$("#myselector").mouseover(function( event ) {
$(this).find('a')[0].click();
});
});
</script>
does not work. The humour.js file returns a random jpg/gif that has an <a href> link. How do I get the href link in the javascript file to fire on hover?
Thanks again