Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dhtml menu

Status
Not open for further replies.

meiteens

Programmer
Jan 18, 2001
14
LV
hello!

i'm looking for a drop-down menu and somehow can't figure out how to do it.. so - the menu should be activated when clicking on a rollover image.. but while a 'drop-down' layer is active the rollover should also stay active (and that's the thing i have no idea how to do).. anyone knows a good script for that?

thanks,
gunta

--
 
hi! ya, i know about the hiermenus, but i already have a script i use, and maybe just some little changes would be necessary, for the rollovers to stay active..

what i need is, when layer txt[1] is on, the rollover 'pak' should stay active also when the mouse is not over it..

hope someone can help :)

the script is ->


var head = new Array();
var menu = new Array();

for(i=1;i<=10;i++) {
head = 0; menu = 0; }

function newlayer(text, id, t, l) {
if (document.layers) {
var str=&quot;<layer id=menu&quot; + id + &quot; top=&quot; + t + &quot; left=&quot; + l + &quot; onmouseover=\&quot;menu[&quot; + id + &quot;]=1;\&quot; onmouseout=\&quot;turn('&quot; + id + &quot;',0);menu[&quot; + id + &quot;]=0;\&quot; visibility=hide>&quot; + text + &quot;</layer>&quot;;
document.write(str); }

else if(document.all) {
var strng=&quot;<div id=menu&quot; + id + &quot; style=\&quot;position:absolute;top:&quot; + t + &quot;;left:&quot; + l + &quot;;visibility:hidden;width:100;filter:alpha(opacity=78);\&quot; onmouseover=\&quot;menu[&quot; + id + &quot;]=1;\&quot; onmouseout=\&quot;turn('&quot; + id + &quot;',0);menu[&quot; + id + &quot;]=0;\&quot;>&quot; + text + &quot;</div>&quot;;
document.write(strng); } }

function turn(id, mode) {
if(document.layers || document.all) {
if(mode)
eval(&quot;setTimeout(\&quot;turnon(&quot; + id + &quot;, &quot; + mode + &quot;);\&quot;,100)&quot;);
else
eval(&quot;setTimeout(\&quot;turnoff(&quot; + id + &quot;, &quot; + mode + &quot;);\&quot;,100)&quot;); } }

function turnon(id, mode){
if(head[id])
if(document.all)
eval(&quot;menu&quot; + id).style.visibility = 'visible';
else if(document.layers)
eval(&quot;document.layers['menu&quot; + id + &quot;']&quot;).visibility = &quot;show&quot;; }

function turnoff(id, mode){
if(!menu[id] && !head[id])
if(document.all)
eval(&quot;menu&quot; + id).style.visibility = 'hidden';
else if(document.layers)
eval(&quot;document.layers['menu&quot; + id + &quot;']&quot;).visibility = &quot;hide&quot;; }

function on(nos) {
if (document.images) {
document[nos].src = eval(nos + &quot;on.src&quot;);
} }

function off(nos) {
if (document.images) {
document[nos].src = eval(nos + &quot;off.src&quot;);
} }


txt = new Array();

txt[1] = &quot;<table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot; width=\&quot;120\&quot; height=\&quot;158\&quot;><tr><td width=\&quot;1\&quot; bgcolor=\&quot;#666666\&quot;><img src=\&quot;img/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;1\&quot;></td><td bgcolor=\&quot;#cccccc\&quot; valign=\&quot;top\&quot;><table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot; width=\&quot;118\&quot;><tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Tehniskâ apsardze</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Piekïûðanas kontrole</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Fiziskâ apsardze</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Video novçroðana</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Droðîbas koncepcija</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>GPS</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Montâþa</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Ugunsdzçsîba</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Reìistrçtiem lietotâjiem</a></td></tr></table></td><td width=\&quot;1\&quot; bgcolor=\&quot;#666666\&quot;><img src=\&quot;img/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;1\&quot;></td></tr><tr><td colspan=\&quot;3\&quot; bgcolor=\&quot;#CC0028\&quot; height=\&quot;3\&quot;><img src=\&quot;img/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;4\&quot;></td></tr></table>&quot;;

txt[2] = &quot;<table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot; width=\&quot;100\&quot;><tr><td width=\&quot;1\&quot; bgcolor=\&quot;#666666\&quot;><img src=\&quot;img/spacer.gif\&quot; width=\&quot;1\&quot;></td><td bgcolor=\&quot;#cccccc\&quot; valign=\&quot;top\&quot;><table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot; width=\&quot;98\&quot;><tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Ziòas</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Preses relîzes</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Publikâcijas</a></td></tr><td><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Jaunie pakalpojumi</a></td></tr><td valign=\&quot;top\&quot;><img src=\&quot;img/home/red.gif\&quot; width=\&quot;3\&quot; height=\&quot;3\&quot; hspace=\&quot;3\&quot; vspace=\&quot;7\&quot;></td><td><a class=\&quot;menu1\&quot; href=\&quot;#\&quot;>Droðîbas koncepcija</a><br><img src=\&quot;img/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;3\&quot;></td></tr></table></td><td width=\&quot;1\&quot; bgcolor=\&quot;#666666\&quot;><img src=\&quot;img/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;1\&quot;></td></tr><tr><td colspan=\&quot;3\&quot; bgcolor=\&quot;#CC0028\&quot; height=\&quot;4\&quot;><img src=\&quot;img/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;4\&quot;></td></tr></table>&quot;;

newlayer(txt[1], 1, 97, 15);
newlayer(txt[2], 2, 97, 135);

if (document.images)

{
pakon = new Image(); pakon.src = &quot;img/home/pakalp2.gif&quot;;
pakoff = new Image(); pakoff.src = &quot;img/home/pakalp.gif&quot;;
aktualon = new Image(); aktualon.src = &quot;img/home/aktual2.gif&quot;;
aktualoff = new Image(); aktualoff.src = &quot;img/home/aktual.gif&quot;;
}

function on(nos) {
if (document.images) {
document[nos].src = eval(nos + &quot;on.src&quot;); } }

function off(nos) {
if (document.images) {
document[nos].src = eval(nos + &quot;off.src&quot;);} }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top