Jump to content
revanger

javascript menu

Recommended Posts

Salut. In primu rand vreau sa va zic ca nu-s advance in javascript asa ca.... Vreau sa fac un meniu in javascript. Unde ma blochez eu: ei bine, in principiu ar fi piece of cake insa eu vreau ca tinand mousu pe o imagine/div sa rezulte un alt div, un fel de extensie la eventu' mouseover. Asta am reusit sa fac usor.

 
<html>
<head>
<title>Javascript DOM</title>
<script type="text/css">
</script>
<script type="text/javascript" language="javascript">
sub = 0;
function CreateDiv()
{
var t = document.createElement("div");
t.id = "div1";
t.setAttribute('style','position:absolute; top:80; left:90');
t.innerHTML = "<a href=\"www.google.ro\"><img src='imaginea' id = 'h' border = '0' onmouseover=\"document.getElementById('h').src = 'imaginea'\" onmouseout=\"RemoveDiv()\">";
document.body.appendChild(t);
}
function RemoveDiv()
{
var p2 = document.getElementById('div1');
document.body.removeChild(p2);
}
</script>
</head>
<body>
<div style="position:absolute; top:20; left: 100;" onmouseover= "CreateDiv()" onmouseout=""><a href="www.google.ro"><img border ="0" id="hey" src="imaginea"></a></div>
</body>
</html>

Acuma, desi am evitat clasicele show/hide sa mor daca stiu cum sa fac incat sa nu m-i se dileasca divu decat daca mousul nu e pe divul hey sau daca nu e pe noul creatul div. As avea nevoie de o idee cum sa fac. Eu m-am gandit la o functie care sa returneze pozitia mousului si daca nu e acolo atunci sa fac o functie care verifica la interval de cateva secunde daca e sau nu unde trebuie mousul, insa nu vreau sa ma complic atata! Care ar fi o modalitate mai usoara? Mersi, revanger.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...