Jump to content

[SOLVED] onmouseover


asmith

Recommended Posts

guys i am more than a noob in JAVA . till now i prevented coding with JAVA , but now i've faced something i must do with JAVA.

 

i want to show some links for example 3 links  when the mouse cursor goes on a picture. 

 

again  i want to know how can i open a square (not a new window, oh yea , like php freaks when your mouse goes on a function name)

 

and in that square i show the links or show a little html code and the user be able to click on those links  .

 

 

any simple code i could apply ?

 

thanks

Link to comment
Share on other sites

this is javascript; not java - there two different languages.

 

<script language="javascript">

function showLinks()
{
document.getElementById('myLinks').style.display='block';
}

function hideLinks()
{
document.getElementById('myLinks').style.display='none'
}

</script>

<img src="" onmouseover="showLinks()" onmouseout="hideLinks()">

<div id="myLinks" style="display:none" onmouseover="showLinks()" onmouseout="hideLinks()">

<a href="http://www.google.com">Google</a>
<a href="http://www.yahoo.com">Yahoo</a>
<a href="http://www.msn.com">MSN</a>

</div>

Link to comment
Share on other sites

thanks i understood it whole !

but some prolblems i've got with it . it is hard with it to move the mouse cursor to the new links . i have to click a few times on the image to make the links be fix on the screen , so i could navigate to them nd click on them .

 

1. how can i make it when the mouse go on the image , when the links appear i could easy goto the links ?

 

2. when te div part is displayed it mess up other elements in the page. you know what i mean  ? when the div is shown , it will be placed between other sites elements. i just want it shows up div "over" the html page. not "in" the html page . like phpfreaks on functions .

 

thanks a bunch

Link to comment
Share on other sites

this should solve your first point..

 

<script language="javascript">

function showLinks()
{
document.getElementById('myLinks').style.display='block';
}

function hideLinks()
{
document.getElementById('myLinks').style.display='none'
}

</script>

<div id="myLinks1" onmouseover="showLinks()">
<img src="" onmouseover="showLinks()" onmouseout="hideLinks()">
<div id="myLinks" style="display:none" onmouseover="showLinks()" onmouseout="hideLinks()">



<a href="http://www.google.com">Google</a>
<a href="http://www.yahoo.com">Yahoo</a>
<a href="http://www.msn.com">MSN</a>

</div>
</div>

Link to comment
Share on other sites

 

1.) If you move your mouse vertically down from the image, to the div that has that contains the links; then you shouldn't have any problems - this is how a vertical menu works.

 

2.) You need to set the css style for the div; with a position of "absolute" and a z-index higher then all the other elements in your page (I usually set mine to 1000).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.