473,746 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can u help to solve Menu problem in Html using javascript

144 New Member
Hai friends..for menu to use in my website..i found in one website....pl look below website....

http://www.dynamicdrive.com/dynamici...lide/index.htm

i downloaded 2 files....

menuitems.js

mmenu.js

you can see the demo of that in http://www.dynamicdrive.com/dynamici...slide/demo.htm

and added in my html file ...

problem i face is menuitems background color and design is changed .just check and tell me..look the demo u can understand....h ow i can solve this problem....ITS URGENT I want as in demo

my coding is below....
mmenu.js
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language="javascript">
  4. if (typeof window.attachEvent=='object'){
  5. document.write('<!--[if lte IE 6]>\n'+
  6. '<script type="text/javascript">\n'+
  7. 'var ie6_or_less=1;\n'+
  8. '<\/script>\n'+
  9. '<![endif]-->\n'+
  10. '<!--[if lt IE 5.5]>\n'+
  11. '<script type="text/javascript">\n'+
  12. 'var less_than_ie5_5=1;\n'+
  13. '<\/script>\n'+
  14. '<![endif]-->')
  15. }
  16.  
  17. var menu=[], resizereinit=true;
  18. function truebody(){
  19. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
  20. }
  21.  
  22. function getedge(o, is_top){
  23. var edge;
  24. if (is_top)
  25. edge=window.pageYOffset? window.pageYOffset : truebody().scrollTop? truebody().scrollTop : 0;
  26. else{
  27. edge=o.menupos=='left'? 0 : truebody().clientWidth? truebody().clientWidth : window.innerWidth&&truebody().offsetHeight<=window.innerHeight? window.innerWidth :  window.innerWidth? window.innerWidth-20 : 0;
  28. edge+=window.pageXOffset? window.pageXOffset : truebody().scrollLeft? truebody().scrollLeft: 0;
  29. }
  30. return edge;
  31. }
  32.  
  33. function keep_in_view(o){
  34. if(o.keepinview){
  35. if(o.m.ft){
  36. o.m.ft=0;
  37. o.m.topP=o.m.offsetTop;
  38. o.m.ltop=0;
  39. }
  40. var pt=getedge(o, 'top'), ks=typeof o.keepinview=='number'&&o.keepinview<o.m.topP&&o.keepinview>0? o.keepinview : o.m.topP, smooth=0;
  41. if (pt!=o.m.ltop){
  42. if(o.menupos=='top')
  43. o.m.style.visibility='hidden';
  44. smooth = pt>o.m.topP-ks? .2 * (pt - o.m.ltop - o.m.topP + ks) : o.m.ltop>0? -.2 * o.m.ltop : 0;
  45. smooth = smooth > 0 ? Math.ceil(smooth) : Math.floor(smooth);
  46. }
  47. else if(o.menupos=='top')
  48. o.m.style.visibility='';
  49. o.m.style.top=(o.m.style.top? parseInt(o.m.style.top) : o.m.topP)+smooth+'px';
  50. o.m.ltop += smooth;
  51. }
  52. if(o.menupos=='top'){
  53. if(typeof o.menuleft=='string'){
  54. o.m.style.left=o.menuleft
  55. o.m.style.marginLeft= Math.floor(o.m.getElementsByTagName('div')[0].offsetWidth/-2)+'px';
  56. o.lleft=o.m.offsetLeft;
  57. }
  58. o.m.style.marginLeft=0;
  59. o.m.style.left=o.lleft+(window.pageXOffset? window.pageXOffset : truebody().scrollLeft? truebody().scrollLeft: 0)+'px';
  60. }
  61. else
  62. o.m.style.left=getedge(o)-(o.menupos=='right'? o.m.offsetWidth : 0)+'px';
  63. }
  64. function move(el, num){
  65. el.getElementsByTagName('div')[0].style[el.menupos]= parseInt(el.getElementsByTagName('div')[0].style[el.menupos])+num+'px';
  66. if(el.menupos=='right'){
  67. if(el.kviewtype=='absolute')
  68. el.style.left=parseInt(el.style.left)-num+'px';
  69. el.style.width=parseInt(el.style.width)+num+'px';
  70. }
  71. if(num>0)
  72. el.moving=setTimeout(function(){movein(el)}, el.menuspeed)
  73. else
  74. el.moving=setTimeout(function(){moveout1(el)}, el.menuspeed)
  75. }
  76. function movein(el){
  77. var m1=parseInt(el.getElementsByTagName('div')[0].style[el.menupos]);
  78. if(el.moving)
  79. clearTimeout(el.moving);
  80. if (m1<-1*el.borderwidth)
  81. move(el, Math.min(-1*m1-el.borderwidth, 10));
  82. }
  83. function moveout(el){
  84. if(el.moving)
  85. clearTimeout(el.moving);
  86. el.moving=setTimeout(function(){moveout1(el)}, el.menupause);
  87. }
  88. function moveout1(el){
  89. var aw=el.menupos=='top'? el.b.offsetHeight : el.b.offsetWidth, m1=el.getElementsByTagName('div')[0];
  90. if(el.moving)
  91. clearTimeout(el.moving);
  92. if (parseInt(m1.style[el.menupos])>aw-(el.menupos=='top'? m1.offsetHeight : m1.offsetWidth)+10)
  93. move(el, -10);
  94. else {
  95. m1.style[el.menupos]=aw-(el.menupos=='top'? m1.offsetHeight : m1.offsetWidth)+'px';
  96. if(el.menupos=='right'){
  97. el.style.width=aw+'px';
  98. if(el.kviewtype=='absolute'){
  99. var ed=truebody().clientWidth? truebody().clientWidth : window.innerWidth&&truebody().offsetHeight<=window.innerHeight? window.innerWidth :  window.innerWidth? window.innerWidth-20 : 0;
  100. ed+=window.pageXOffset? window.pageXOffset : truebody().scrollLeft? truebody().scrollLeft: 0;
  101. el.style.left=ed-el.offsetWidth+'px';
  102. }
  103. }
  104. }
  105. }
  106. function to_em(n, o){
  107. return Math.round((n/(16*parseInt(o.fontsize)/100))*1000)/1000;
  108. }
  109. function getrows(o){
  110. var r=o.menuItems.length+(o.wrapbar? 1 : 0);
  111. for (var i_tem = 0; i_tem < o.menuItems.length; i_tem++)
  112. if (o.menuItems[i_tem][4]&&o.menuItems[i_tem][4]=='no')
  113. r--;
  114. return r;
  115. }
  116. function make_bar(o){
  117. var bt=o.menupos=='right'||o.menupos=='top'? '<tr>' : '';
  118. bt+='<td id="'+o.id+'bar" '+(o.menupos=='top'? 'colspan="'+o.d_colspan : 'rowspan="'+getrows(o))+'">'
  119. if (!/<img/.test(o.bartext.toLowerCase())){
  120. for (var i_tem = 0; i_tem < o.bartext.length-(o.menupos=='top'? 1 : 0); i_tem++)
  121. bt+=o.menupos=='top'&&o.bartext.charAt(i_tem)==' '? '\u00a0 ' : o.menupos=='top'? o.bartext.charAt(i_tem)+' ' : '<br>'+o.bartext.charAt(i_tem);
  122. bt+=o.menupos=='top'? o.bartext.charAt(o.bartext.length-1)+'</td>' : '<br>\u00a0</td>';
  123. }
  124. else
  125. bt+=o.bartext+'</td>'
  126. return bt+(o.menupos=='right'? '\n' : '</tr>\n');
  127. }
Expand|Select|Wrap|Line Numbers
  1. function make_style(o){
  2. if(o.user_defined_stylesheet&&!o.design_mode)
  3. return '';
  4. var sheet=''
  5. sheet+='#'+o.id+' {\n'+
  6. (o.menupos=='top'? 'top:0;\n' : 'top:'+o.menutop+'px; /*set initial Height from top*/\n')+
  7. (o.menupos=='top'? 'left:'+o.menuleft+(typeof o.menuleft=='number'? 'px' : '')+';\n' : '')+
  8. (o.menupos=='right'&&o.kviewtype=='fixed'? 'right:0;\n' : '')+
  9. 'position:'+o.kviewtype+';\n'+
  10. 'overflow:'+(o.menupos=='right'? 'hidden' : 'visible')+';\n'+
  11. 'z-index:100;\n'+
  12. (o.menupos=='left'? 'left:0;\n' : '')+
  13. '}\n'+
  14. '#'+o.id+' div {\n'+
  15. 'border-width:'+(typeof o.outbrdwidth=='number'? o.outbrdwidth+'px' : o.outbrdwidth)+'; /*Menu\'s outer border*/\n'+
  16. 'border-style:'+o.outbrdstyle+';\n'+
  17. (o.outbrdcolor=='none'? '' : 'border-color:'+o.outbrdcolor+';\n')+
  18. 'position:absolute;\n'+
  19. 'color:black;\n'+
  20. 'background-color:transparent;\n'+
  21. '}\n'+
  22. '#'+o.id+' table {\n'+
  23. 'border:'+o.borderwidth+'px '+o.borderstyle+' '+o.bordercolor+'; /*Menu\'s inner border*/\n'+
  24. (o.menupos=='top'? 'border-left-width:0;\n' : '')+
  25. (o.menupos=='top'? 'border-bottom-width:0;\n' : '')+
  26. 'font-family:'+o.menufont+', sans-serif; /*Overall font for Menu*/\n'+
  27. 'font-size:'+o.fontsize+';\n'+
  28. 'border-collapse:collapse;\n'+
  29. 'background-color:'+(o.allowtransparent? 'transparent' : o.bordercolor)+';\n'+
  30. 'width:'+to_em(o.barwidth+o.hdingwidth+o.borderwidth*(o.d_colspan+2), o)+'em;\n'+
  31. '}\n'+
  32. '#'+o.id+' td { /*Characteristics for cells in the menu table - do not specify width here*/\n'+
  33. 'border-bottom:'+o.borderwidth+'px '+o.borderstyle+' '+o.bordercolor+';\n'+
  34. 'border-left:'+o.borderwidth+'px '+o.borderstyle+' '+o.bordercolor+';\n'+
  35. 'height:'+to_em(o.linkheight, o)+'em;\n'+
  36. 'padding:0;\n'+
  37. 'margin:0;\n'+
  38. 'text-align:'+o.linktxtalign+';\n'+
  39. '}\n'+
  40. '#'+o.id+' #'+o.id+'bar { /*Characteristics for initially visible \'draw\' bar (the vertical cell)*/\n'+
  41. (o.menupos=='top'? 'height:' : 'width:')+to_em(o.barwidth+(document.all||o.menupos=='top'? o.borderwidth*2 : 0), o)+'em;\n'+
  42. 'background-color:'+o.barbgcolor+';\n'+
  43. 'color:'+o.barcolor+';\n'+
  44. 'font-weight:'+o.barfontweight+';\n'+
  45. 'text-align:'+o.baralign+';\n'+
  46. (o.menupos=='top'? '' : 'border-width:0;\n')+
  47. 'cursor:default;\n'+
  48. '}\n'+
  49. '#'+o.id+' .heading { /*Characteristics for heading cells in the menu table*/\n'+
  50. 'height:'+to_em(o.hdingheight, o)+'em;\n'+
  51. 'color:'+o.hdingcolor+';\n'+
  52. 'font-weight:'+o.hdingfontweight+';\n'+
  53. 'text-indent:'+o.hdingindent+'ex;\n'+
  54. 'background-color:'+o.hdingbgcolor+'; /*Background Color for menu headings */\n'+
  55. 'width:'+to_em(o.hdingwidth, o)+'em; /*This will be the menu body width.  This'+(o.menupos!='top'? ' (plus #'+o.id+'bar width for left and right menus)' : '')+' and 4 times the border width should also be the menu table\'s approximate width*/\n'+
  56. 'vertical-align:'+o.hdingvalign+';\n'+
  57. 'text-align:'+o.hdingtxtalign+';\n'+
  58. 'border-left-color:'+o.hdingbgcolor+';\n'+
  59. 'border-left-style:solid;\n'+
  60. '}\n'+
  61. (o.wrapbar&&o.menupos!='top'? '#'+o.id+' #'+o.id+'lastrow {\n'+
  62. 'height:'+to_em(o.barwidth, o)+'em;\n'+
  63. 'background-color:'+o.barbgcolor+';\n'+
  64. 'border-width:0;\n'+
  65. 'margin:0 0 '+o.borderwidth+'px '+o.borderwidth+'px;\n'+
  66. '}\n' : o.menupos!='top'? '#'+o.id+' #'+o.id+'lastrow {\n'+
  67. 'border-bottom-width:0;\n'+
  68. 'margin:0 0 '+o.borderwidth+'px '+o.borderwidth+'px;\n'+
  69. '}\n' : '')+
  70. '#'+o.id+' a {\n'+
  71. 'width:100%;\n'+
  72. 'height:100%;\n'+
  73. 'display:block;\n'+
  74. 'padding-top:'+to_em(o.linktopad, o)+'em;\n'+
  75. '}\n';
  76. if(o.design_mode){
  77. if(document.getElementById('ooostyle'))
  78. alert('Only one menu\'s script generated styles may be displayed at a time!\n\nCurrently showing '+document.getElementById('ooostyle').tell+'\'s stylesheet\n\n(or there is a syntax error - most\n\u00a0\u00a0\u00a0\u00a0likely in the menuItem.js file)');
  79. else{
  80. var isusing=o.user_defined_stylesheet? ' not' : '';
  81. var sw=(window.innerWidth? window.innerWidth : truebody().clientWidth)/1.5; 
  82. document.write('<textarea id="ooostyle" cols="'+Math.floor(sw/8)+'" rows="65" wrap="off" style= "margin-left:-'+ Math.floor(sw/2) +'px;overflow:auto;position:absolute;top:10px;left:50%;z-index:1000;">\n')
  83. document.write('\/* '+o.id+'\'s Script Generated Styles: */\n\/* '+o.id+' is'+isusing+' currently using these via the script */\n\n'+sheet);
  84. document.write('\n\/* End '+o.id+'\'s Script Generated Styles */');
  85. document.write('</textarea>')
  86. document.getElementById('ooostyle').tell=o.id;
  87. }
  88. }
  89. if(!o.user_defined_stylesheet)
  90. return '<style type="text/css">\n'+sheet+'</style>';
  91. return '';
  92. }
Expand|Select|Wrap|Line Numbers
  1. function make_style_make_menu(o, s){
  2. if(s){
  3. if(!o.id) {alert('a unique id is required for each menu');return;};
  4. if(!o.menuItems||o.menuItems.constructor!=Array) {alert('an array of menu items is required for each menu');return;};
  5. if(!o.menutop) {o.menutop=150};
  6. if(!o.menuleft) {o.menuleft='50%'};
  7. if(!o.keepinview&&typeof o.keepinview=='boolean')
  8. o.keepinview=false;
  9. else if(!o.keepinview) {o.keepinview=30};
  10. if(!o.menuspeed) {o.menuspeed=20};
  11. if(!o.menupause) {o.menupause=500};
  12. if(!o.d_colspan) {o.d_colspan=2};
  13. if(!o.allowtransparent) {o.allowtransparent=false};
  14. if(!o.barwidth) {o.barwidth=22};
  15. if(!o.hdingwidth) {o.hdingwidth=149};
  16. if(!o.hdingheight) {o.hdingheight=22};
  17. if(!o.hdingindent) {o.hdingindent=1};
  18. if(!o.linkheight) {o.linkheight=16};
  19. if(!o.outbrdwidth) {o.outbrdwidth=0};
  20. if(!o.outbrdcolor) {o.outbrdcolor="none"};
  21. if(!o.outbrdstyle) {o.outbrdstyle="none"};
  22. if(!o.borderwidth) {o.borderwidth=1};
  23. if(!o.bordercolor) {o.bordercolor="black"};
  24. if(!o.borderstyle) {o.borderstyle="solid"};
  25. if(!o.barcolor) {o.barcolor="white"};
  26. if(!o.barbgcolor) {o.barbgcolor="#444444"};
  27. if(!o.barfontweight) {o.barfontweight="bold"};
  28. if(!o.baralign) {o.baralign="center"};
  29. if(!o.menufont) {o.menufont="verdana"};
  30. if(!o.fontsize) {o.fontsize="80%"};
  31. if(!o.hdingcolor) {o.hdingcolor="white"};
  32. if(!o.hdingbgcolor) {o.hdingbgcolor="#170088"};
  33. if(!o.hdingfontweight) {o.hdingfontweight="bold"};
  34. if(!o.hdingvalign) {o.hdingvalign="middle"};
  35. if(!o.hdingtxtalign) {o.hdingtxtalign="left"};
  36. if(!o.linktopad) {o.linktopad=0};
  37. if(!o.linktxtalign) {o.linktxtalign="left"};
  38. if(!o.linktarget) {o.linktarget=""};
  39. if(!o.menupos) {o.menupos="left"};
  40. if(!o.bartext) {o.bartext="SIDE MENU"};
  41. if(!o.user_defined_stylesheet) {o.user_defined_stylesheet=false};
  42. if(!o.user_defined_markup) {o.user_defined_markup=false};
  43. if(!o.design_mode) {o.design_mode=false};
  44. if(!o.wrapbar) {o.wrapbar=false};
  45. if(!o.kviewtype) {o.kviewtype='absolute'};
  46. if(typeof ie6_or_less!='undefined')
  47. o.kviewtype='absolute';
  48. else if(o.menupos=='top'&&o.kviewtype=='absolute')
  49. o.kviewtype='fixed';
  50. while(!o.menuItems[o.menuItems.length-1])
  51. o.menuItems.length=o.menuItems.length-1;
  52. document.write(make_style(o));
  53. return;
  54. }
  55. else {
  56. if(o.design_mode||!o.user_defined_markup){
  57. var hw=o.hdingwidth;
  58.  
  59. var tb='<div id="'+o.id+'" onmouseover="movein(this);" onmouseout="moveout(this);"><div><table>\n';
  60. tb+=o.menupos=='right'? make_bar(o) : '';
  61. for (var i_tem = 0; i_tem < o.menuItems.length; i_tem++){
  62. if ((o.menupos=='top'&&i_tem==0)||i_tem>0&& (!o.menuItems[i_tem-1][4]||o.menuItems[i_tem-1][4]!=='no'))
  63. tb+='<tr>'
  64. if (o.menuItems[i_tem][1]&&o.menuItems[i_tem][1]!==''){
  65. tb+='<td '+(i_tem==o.menuItems.length-1&&!o.wrapbar&&o.menupos!='top'? 'id="'+o.id+'lastrow" ' : '')+'colspan="'+(o.menuItems[i_tem][3]&&o.menuItems[i_tem][3]!==''? o.menuItems[i_tem][3] : o.d_colspan)+'"><a href="'+o.menuItems[i_tem][1]+'" target="'+(o.menuItems[i_tem][2]? o.menuItems[i_tem][2] : o.linktarget)+'">'+o.menuItems[i_tem][0]+'</a></td>'
  66. }
  67. else
  68. tb+='<td '+(i_tem==o.menuItems.length-1&&!o.wrapbar&&o.menupos!='top'? 'id="'+o.id+'lastrow" ' : '')+'class="heading" '+(o.menuItems[i_tem][3]&&o.menuItems[i_tem][3]!==''&& o.menuItems[i_tem][3]!==o.d_colspan? 'style="width:'+to_em(hw*o.menuItems[i_tem][3]/o.d_colspan, o)+'em;'+(i_tem>0&&o.menuItems[i_tem-1][4]&& o.menuItems[i_tem-1][4]=='no'? 'border-left-width:0;margin-left:'+o.borderwidth+'px;' : '')+'" ' : '')+'colspan="'+(o.menuItems[i_tem][3]&&o.menuItems[i_tem][3]!==''? o.menuItems[i_tem][3] : o.d_colspan)+'">'+o.menuItems[i_tem][0]+'</td>'
  69. if (!o.menuItems[i_tem][4]||o.menuItems[i_tem][4]!=='no')
  70. tb+=o.menupos=='left'&&i_tem==0? make_bar(o) : '</tr>\n';
  71. }
  72. tb+=o.wrapbar&&o.menupos!='top'? '<tr><td id="'+o.id+'lastrow" colspan="'+o.d_colspan+'">\u00a0</td></tr>\n' : '';
  73. tb+=o.menupos=='top'? make_bar(o) : '';
  74.  
  75. if(!o.user_defined_markup)
  76. document.write(tb+'</table></div></div>')
  77. }
  78. if(o.design_mode)
  79. document.getElementById('ooostyle').value+='\n\n<!-- The Markup for '+o.id+' -->\n\n'+tb+'</table></div></div>\n\n<!-- End '+o.id+'\'s Markup -->'
  80. o.m=document.getElementById(o.id);
  81. var b=document.getElementById(o.id+'bar');
  82. o.m.b=b;
  83. o.m.ft=1;
  84. o.m.menupos=o.menupos;
  85. o.m.menupause=o.menupause;
  86. o.m.menuspeed=o.menuspeed;
  87. o.m.borderwidth=o.borderwidth;
  88. o.m.kviewtype=o.kviewtype;
  89. resizevent(o);
  90. if(o.menupos=='top'&&typeof window.attachEvent=='object'&&typeof ie6_or_less!='undefined')
  91. window.attachEvent('onscroll', function(){o.m.style.visibility='hidden';});
  92. if(o.kviewtype=='absolute'&&(o.menupos!='top'||(typeof ie6_or_less!='undefined'&&typeof window.attachEvent=='object')))
  93. setInterval(function(){keep_in_view(o)}, 20)
  94. }
  95. }
Apr 10 '08 #1
2 2463
acoder
16,027 Recognized Expert Moderator MVP
I split your post up since it wasn't appearing in one post: Here's the rest:
Expand|Select|Wrap|Line Numbers
  1. function resizevent(o){
  2. var m1=o.m.getElementsByTagName('div')[0], bo=o.menupos=='top'? o.m.b.offsetHeight : o.m.b.offsetWidth;
  3. m1.style[o.menupos]=bo-(o.menupos=='top'? m1.offsetHeight : m1.offsetWidth)+'px'
  4. if(o.menupos=='right'){
  5. if(o.kviewtype=='absolute')
  6. o.m.style.left=getedge(o)-o.m.offsetWidth+'px';
  7. o.m.style.width=bo+'px';
  8. o.m.style.height=m1.offsetHeight+'px';
  9. if(typeof less_than_ie5_5!='undefined'){
  10. o.m.onmouseover(o.m);
  11. o.m.onmouseout(o.m);
  12. }
  13. }
  14. if(o.menupos=='top'){
  15. o.m.style.width=m1.style.width=o.m.getElementsByTagName('table')[0].offsetWidth+'px';
  16. if(typeof o.menuleft=='string')
  17. o.m.style.marginLeft=Math.floor(m1.offsetWidth/-2)+'px';
  18. }
  19. }
  20. /*
  21.  
  22. ONTEXTRESIZE EVENT SPOOFER
  23.  
  24. Including this file in your page will allow you to assign a function
  25. to window.ontextresize, which will be called when the user changes the
  26. size of text on the page.
  27.  
  28. Used with (as far as I know) permission from: http://forkandspoonhelmet.com/Fork_and_Spoon_Helmet
  29.  
  30. */
  31. var ontextresizeLastSize = false;
  32. if (window.attachEvent) window.attachEvent("onload", initOntextresizeListener);
  33. else if (window.addEventListener) window.addEventListener("load", initOntextresizeListener, false);
  34. function initOntextresizeListener() {
  35. if(!resizereinit||typeof less_than_ie5_5!='undefined')
  36. return;
  37.     var testDiv = document.createElement("div");
  38.     testDiv.style.position = "absolute";
  39.     testDiv.style.height = "1em";
  40.     testDiv.style.width = "1em";
  41.     testDiv.style.top = "-2em";
  42.     testDiv.style.left = "-2em";
  43.     var docTestDiv = document.body.appendChild(testDiv);
  44.     docTestDiv.id = "ontextresizeTestDiv";
  45.     ontextresizeListener = setInterval("ontextresizeCheckTestDiv()",100);
  46. }
  47. function ontextresizeCheckTestDiv() {
  48.     if (ontextresizeLastSize!=document.getElementById("ontextresizeTestDiv").offsetWidth) {
  49.         if (ontextresizeLastSize && window.ontextresize) window.ontextresize.call();
  50.         ontextresizeLastSize = document.getElementById("ontextresizeTestDiv").offsetWidth;
  51.     }
  52. }
  53. window.ontextresize=function(){
  54. for (var i_tem = 0; i_tem < menu.length; i_tem++)
  55. if(typeof menu[i_tem]!='undefined')
  56. resizevent(menu[i_tem]);
  57. };
  58.  
  59. function make_menus(){
  60. if(document.getElementById){
  61. for (var i_tem = 0; i_tem < menu.length; i_tem++)
  62. if(typeof menu[i_tem]!='undefined')
  63. make_style_make_menu(menu[i_tem], 's');
  64. for (i_tem = 0; i_tem < menu.length; i_tem++)
  65. if(typeof menu[i_tem]!='undefined')
  66. make_style_make_menu(menu[i_tem]);
  67. }
  68. }
Expand|Select|Wrap|Line Numbers
  1. /***********************************************
  2. * Omni Slide Menu script - © John Davenport Scheuer
  3. * very freely adapted from Dynamic-FX Slide-In Menu (v 6.5) script- by maXimus
  4. * This notice MUST stay intact for legal use
  5. * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full original source code
  6. * as first mentioned in http://www.dynamicdrive.com/forums
  7. * username:jscheuer1
  8. ***********************************************/
  9.  
  10. //One global variable to set, use true if you want the menus to reinit when the user changes text size (recommended):
  11. menuitems.js
  12. resizereinit=true;
  13.  
  14. menu[1] = {
  15. id:'menu1', //use unique quoted id (quoted) REQUIRED!!
  16. fontsize:'100%', // express as percentage with the % sign
  17. linkheight:22 ,  // linked horizontal cells height
  18. hdingwidth:210 ,  // heading - non linked horizontal cells width
  19. // Finished configuration. Use default values for all other settings for this particular menu (menu[1]) ///
  20.  
  21. menuItems:[ // REQUIRED!!
  22. //[name, link, target, colspan, endrow?] - leave 'link' and 'target' blank to make a header
  23. ["Menu"], //create header
  24. ["Dynamic Drive", "http://www.dynamicdrive.com", ""],
  25. ["What's New", "http://www.dynamicdrive.com/new.htm",""],
  26. ["What's Hot", "http://www.dynamicdrive.com/hot.htm", ""],
  27. ["Message Forum", "http://www.dynamicdrive.com/forums", ""],
  28. ["Submit Script", "http://www.dynamicdrive.com/submitscript.htm", ""],
  29. ["Link to Us", "http://www.dynamicdrive.com/link.htm", ""],
  30.  
  31. ["FAQ", "http://www.dynamicdrive.com/faqs.htm", "", 1, "no"], //create two column row, requires d_colspan:2 (the default)
  32. ["Email", "http://www.dynamicdrive.com/contact.htm", "",1],
  33.  
  34. ["External Links", "", ""], //create header
  35. ["JavaScript Kit", "http://www.javascriptkit.com", "_new"],
  36. ["Freewarejava", "http://www.freewarejava.com", "_new"],
  37. ["Coding Forums", "http://www.codingforums.com", "_new"]  //no comma after last entry
  38.  
  39. ]}; // REQUIRED!! do not edit or remove
  40.  
  41. menu[2] = {  // REQUIRED!!  This menu explicitly declares all available options even if they are the same as the defaults
  42. id:'menu2', //use unique quoted id (quoted) REQUIRED!!
  43. /////////////////////////////////////
  44. ///////////// no quotes for these properties (numbers represent pixels unless otherwise noted): ////////////
  45. /////////////////////////////////////
  46. user_defined_stylesheet:false, //if true, prevents script from generating stylesheet for this menu
  47. user_defined_markup:false, //if true, prevents script from generating markup for this menu
  48. design_mode:false,  //if true, generates a report of the script generated/intended styles and markup (as a design aid)
  49. menutop:160,     // initial top offset - except for top menu, where it is meaningless
  50. menuleft:'45%',    // initial left offset - only for top menu, as pixels (can be a quoted percentage - ex: '50%')
  51. keepinview:80,   // Use false (for not static) - OR - true or numeric top offset when page scrolls
  52. menuspeed:20,    // Speed of menu sliding smaller is faster (interval of milliseconds)
  53. menupause:500,   // How long menu stays out when mouse leaves it (in milliseconds)
  54. d_colspan:3,     // Available columns in menu body as integer
  55. allowtransparent:false, // true to allow page to show through menu if other bg's are transparent or border has gaps
  56. barwidth:20,     // bar (the vertical cell) width
  57. wrapbar:true,    // extend and wrap bar below menu for a more solid look (default false) - will revert to false for top menu
  58. hdingwidth:210,  // heading - non linked horizontal cells width
  59. hdingheight:25,  // heading - non linked horizontal cells height
  60. hdingindent:1,   // heading - non linked horizontal cells text-indent represents ex units (@8 pixels decimals allowed)
  61. linkheight:20,   // linked horizontal cells height
  62. linktopad:3,     // linked horizontal cells top padding
  63. borderwidth:2,   // inner border-width used for this menu
  64. /////////////////////////// quote these properties: /////////////////////
  65. bordercolor:'#000080', // inner border color
  66. borderstyle:'solid',    // inner border style (solid, dashed, inset, etc.)
  67. outbrdwidth:'0ex 0ex 0ex 0ex', // outer border-width used for this menu (top right bottom left)
  68. outbrdcolor:'lightblue',  // outer border color
  69. outbrdstyle:'solid',     // outer border style (solid, dashed, inset, etc.)
  70. barcolor:'white',        // bar (the vertical cell) text color
  71. barbgcolor:'#4d6814',   // bar (the vertical cell) background color
  72. barfontweight:'bold',    // bar (the vertical cell) font weight
  73. baralign:'center',       // bar (the vertical cell) right left or center text alignment
  74. menufont:'verdana',      // menu font
  75. fontsize:'90%',          // express as percentage with the % sign
  76. hdingcolor:'white',      // heading - non linked horizontal cells text color
  77. hdingbgcolor:'#4d6814',  // heading - non linked horizontal cells background color
  78. hdingfontweight:'bold',  // heading - non linked horizontal cells font weight
  79. hdingvalign:'middle',    // heading - non linked horizontal cells vertical align (top, middle or center)
  80. hdingtxtalign:'left',    // heading - non linked horizontal cells right left or center text alignment
  81. linktxtalign:'left',     // linked horizontal cells right left or center text alignment
  82. linktarget:'',           // default link target, leave blank for same window (other choices: _new, _top, or a window or frame name)
  83. kviewtype:'fixed',       // Type of keepinview - 'fixed' utilizes fixed positioning where available, 'absolute' fluidly follows page scroll
  84. menupos:'top',         // set side that menu slides in from (right or left or top)
  85. bartext:'MY MENU',       // bar text (the vertical cell) use text or img tag
  86. ///////////////////////////
  87. menuItems:[
  88. //[name, link, target, colspan, endrow?] - leave 'link' and 'target' blank to make a header
  89. ["Hot Sites"], //create header
  90. ["Lois Images", "http://www.loisimages.com", "_new"],
  91. ["State Street Blues", "http://www.statestreetbluesstroll.com/","_new"],
  92. ["Media Jazz by Night", "http://www.mediajazzbynight.com/", "_new"],
  93. ["DD Help Forum", "http://www.dynamicdrive.com/forums", "_new"],
  94.  
  95. ["Search", "", "", 2, "no"], //create two column header w/ 2 and 1 column members, requires d_colspan:3
  96. ["Search", "", "", 1],
  97. ["Google", "http://www.google.com/", "_new", 1, "no"], //create three column row, requires d_colspan:3
  98. ["Yahoo", "http://www.yahoo.com/", "_new", 1, "no"],
  99. ["AltaVista", "http://www.altavista.com/", "_new", 1],
  100.  
  101. ["Personal", "", ""], //create header
  102. ["Ansi Art Gallery", "http://home.comcast.net/~ansiguy", "_new"],
  103. ["John's Javascript Jungle", "http://home.comcast.net/~jscheuer1/side", "_new"]  //no comma after last entry
  104.  
  105. ]}; // REQUIRED!! do not edit or remove
  106.  
  107. menu[3] = {
  108. id:'menu3', //use unique quoted id (quoted) REQUIRED!!
  109. bartext:'RIGHT MENU',
  110. menupos:'right',
  111. kviewtype:'fixed', 
  112. menuItems:[ // REQUIRED!!
  113. //[name, link, target, colspan, endrow?] - leave 'link' and 'target' blank to make a header
  114. ["Menu"], //create header
  115. ["Dynamic Drive", "http://www.dynamicdrive.com", ""],
  116. ["What's New", "http://www.dynamicdrive.com/new.htm",""],
  117. ["What's Hot", "http://www.dynamicdrive.com/hot.htm", ""],
  118. ["Message Forum", "http://www.dynamicdrive.com/forums", ""],
  119. ["Submit Script", "http://www.dynamicdrive.com/submitscript.htm", ""],
  120. ["Link to Us", "http://www.dynamicdrive.com/link.htm", ""],
  121.  
  122. ["FAQ", "http://www.dynamicdrive.com/faqs.htm", "", 1, "no"], //create two column row, requires d_colspan:2 (the default)
  123. ["Email", "http://www.dynamicdrive.com/contact.htm", "",1],
  124.  
  125. ["External Links", "", ""], //create header
  126. ["JavaScript Kit", "http://www.javascriptkit.com", "_new"],
  127. ["Freewarejava", "http://www.freewarejava.com", "_new"],
  128. ["Coding Forums", "http://www.codingforums.com", "_new"]  //no comma after last entry
  129.  
  130. ]}; // REQUIRED!! do not edit or remove
  131.  
  132. ////////////////////Stop Editing/////////////////
  133.  
  134. make_menus();
  135.  
  136.  
  137.  
  138. </script>
  139.  
  140. </head>
  141. </html>
  142.  
Apr 10 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
Instead of posting all that code and expecting someone to wade through it, you could've just posted the relevant parts or the part where you thought the problem lies.

Have you made any changes to the script?
Apr 10 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
5026
by: elad | last post by:
Hi The Menu doesn't work properly when I have 2 frame and the Menu popup frame=document target frame, when I choose item in the menu the doc opened and the menu get stuck. Here is the code I'm using: FrameSet ------------------------------------------------------- <html>
2
1350
by: Brian | last post by:
Hello, I want to design some menus for websites with submenus. I'd like to learn the code myself and I was wondering a good place to pick up on some tips on how to design them. Also, is there a decent program out there that does it all for you at a good price? Thanks,
4
5778
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
2
3893
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at http://home.pacific.net.sg/~jacksony ? (the drop down bar could not work at www.apchosting.net but can drop at home.pacific.net.sg. I suspect it is a server problem but was told it is not possible, therefore assuming it is a client script problem? the script works last time...
3
2525
by: unurban | last post by:
I have a javascript menu based off of unordered lists that only shows the subnav links when you click on the main nav links. is there a way to keep any subnav items open after you click on a link and are transferred to a new page? Here is some of the code:
4
2176
by: rsteph | last post by:
I've found a javascript menu download, I've been tweaking it within a testpage, and getting it to look just right. I finally got everything looking right, all I have to do is alter where the links navigate to. Before I do that I'm trying to get it put into the actual page I want to use it in; right now I've been using a blank html page to test it with. I've done everything just like it is in the test page, but the menu isn't appearing on the...
3
2111
by: John | last post by:
Hi there, I was reading an article (http://avenuea-razorfish.com/articles/TheAll-MenuNavigation_Turbek.pdf) on 'all-menu navigation' and I'd like to try and implement this in my site. Can anyone recommend how to get started? Is there an Ajax control available for this or would more a basic javascript work just as well. I'm assuming I just need a div element that is shown on a mouse over, but I'm not sure how to go about aligning all...
2
1973
by: camelot | last post by:
Hello, I've got a problem and I hope someone could help me. I have a page that contains frames. Below a piece of code: .... <FRAMESET COLS="120,*"> <FRAME NAME="menu" SRC="menu.html" > <FRAME NAME="main" SRC="main.html"> </FRAMESET> .... The page menu.html contains the following code:
0
8970
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8795
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9346
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9279
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8219
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6057
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3287
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2195
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.