asimryu

js menu old style

Sep 25th, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="ko">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>javascript</title>
  6. <style>
  7. #nav { width:100%; height:50px; background:#00f; }
  8. #nav #main a { width:auto; height:50px; color:#fff; line-height:50px; font-size:20px; font-weight:bold; text-decoration:none; display:inline-block;
  9. padding:0 10px;}
  10. #nav #main a:hover { color:#f00; background:#ff0; }
  11. #nav #sub div { width:100%; height:30px; background:#ccc; line-height:30px; display:none; }
  12. </style>
  13. </head>
  14. <body>
  15. <div id="nav">
  16. <div id="main">
  17. <a href="#" onmouseover="m(1);">회사소개</a>
  18. <a href="#" onmouseover="m(2);">제품소개</a>
  19. <a href="#" onmouseover="m(3);">게시판</a>
  20. </div>
  21. <div id="sub">
  22. <div id="sub1">인사말씀 | 연혁 | 찾아오시는 길</div>
  23. <div id="sub2">주방용품 | 벽지 | 페인트</div>
  24. <div id="sub3">공지사항 | 자유게시판 | 갤러리</div>
  25. </div>
  26. </div>
  27. <script>
  28. function m(n) {
  29. for(var i=1;i<=3;i++){
  30. var subid = "sub" + i;
  31. var subdiv = document.getElementById(subid);
  32. if(i == n) {
  33. subdiv.style.display = "block";
  34. } else {
  35. subdiv.style.display = "none";
  36. }
  37. }
  38. }
  39. </script>
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment