473,472 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Making new Div bar

2 New Member
Hi. I'm helping a friend of mine develop an online game, which is currently outdated. The person making skins for the site came up with a cool looking NavBar (found at http://www.thejackofclubs.net/images/soc_concept4.png ) and I want to change the current navbar (which is right now generated via PHP using tables and outdated expressions). The code is
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">        <!-- Modified menu code -->
  2. <!--
  3. /*
  4. This code is from Dynamic Web Coding
  5. www.dyn-web.com
  6. Permission granted to use this code as long as this
  7. entire notice is included.
  8. */
  9. var origWidth, origHeight;
  10. if (document.layers) {
  11.  origWidth = window.innerWidth; origHeight = window.innerHeight;
  12.  window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
  13. }
  14.  
  15. var cur_lyr;
  16. var cur_ulyr;
  17. var invis;
  18. function loadLyr(lyr) {
  19.  if (lyr.length != 3) {
  20.   if (cur_ulyr)
  21.   { hide_lyr(cur_ulyr); }
  22.   if (lyr != cur_ulyr) {
  23.    show_lyr(lyr);
  24.    cur_ulyr = lyr;
  25.   }
  26.   else
  27.   { cur_ulyr = ''; }
  28.  } else {
  29.   if (cur_lyr) hide_lyr(cur_lyr);
  30.   cur_lyr = lyr;
  31.   show_lyr(lyr);
  32.  }
  33. }
  34.  
  35. function show_lyr(lyr) {
  36.  var theLyr = (document.layers)? getLyrRef(lyr,document) : (document.all)? document.all[lyr].style : (document.getElementById)? document.getElementById(lyr).style: null;
  37.  if (!theLyr) return;
  38.  theLyr.zIndex=100;
  39.  theLyr.visibility = "visible";
  40. }
  41.  
  42. function hide_lyr(lyr) {
  43.  var theLyr = (document.layers)? getLyrRef(lyr,document) : (document.all)? document.all[lyr].style : (document.getElementById)? document.getElementById(lyr).style: null;
  44.  if (!theLyr) return;
  45.  theLyr.zIndex=1;
  46.  theLyr.visibility = "hidden";
  47. }
  48.  
  49. function toggle_lyr(lyr) {
  50.  var theLyr = (document.layers)? getLyrRef(lyr,document) : (document.all)? document.all[lyr].style : (document.getElementById)? document.getElementById(lyr).style: null;
  51.  if (!theLyr) return;
  52.  if (theLyr.visibility == "visible")
  53.   theLyr.visibility = "hidden";
  54.  else
  55.   theLyr.visibility = "visible";
  56. }
  57.  
  58. // get reference to nested layer for ns4
  59. // from old dhtmllib.js by Mike Hall of www.brainjar.com
  60. function getLyrRef(lyr,doc) {
  61.  if (document.layers) {
  62.   var theLyr;
  63.   for (var i=0; i<doc.layers.length; i++) {
  64.    theLyr = doc.layers[i];
  65.    if (theLyr.name == lyr) return theLyr;
  66.    else if (theLyr.document.layers.length > 0)
  67.     if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
  68.      return theLyr;
  69.    }
  70.   return null;
  71.  }
  72. }
  73.     //-->
  74.     </script>
  75.     <script type="text/JavaScript">
  76.  
  77.   window.onload = function()
  78.   {
  79.       settings = {
  80.           tl: { radius: 20 },
  81.           tr: { radius: 20 },
  82.           bl: { radius: 0 },
  83.           br: { radius: 0 },
  84.           antiAlias: true,
  85.           autoPad: true,
  86.           validTags: ["div"]
  87.       }
  88.  
  89.       /*
  90.       Usage:
  91.  
  92.       newCornersObj = new curvyCorners(settingsObj, classNameStr);
  93.       newCornersObj = new curvyCorners(settingsObj, divObj1[, divObj2[, divObj3[, . . . [, divObjN]]]]);
  94.       */
  95.       var myBoxObject = new curvyCorners(settings, "myBox");
  96.       myBoxObject.applyCornersToAll();
  97.   }
  98.  
  99. </script>
  100. //Javascript layer code
  101. <?
  102.         function topbutton ($name,$layer,$to,$colour) {
  103.             if ($to == $layer)
  104.             {
  105.                 echo "<TD valign=middle class=menu style='background-color:$colour;'>";
  106.             }
  107.             else
  108.             {
  109.                 ?><TD valign=middle class="menu"
  110.                 onMouseOver="this.style.backgroundColor='<? echo $colour; ?>'; this.style.cursor='hand';"
  111.                 onMouseOut="this.style.backgroundColor='';"><?
  112.                 echo "<A href=\"javascript: void loadLyr('$layer')\">";
  113.             }
  114.             echo $name;
  115.             if ($to != $layer) echo "</A>";
  116.             echo '<IMG src="'.$GLOBALS[evo_imgsrv].'button.rt.gif" width=15 height=15></TD>';
  117.         };
  118.  
  119.         function button ($name,$id,$to) {
  120.             global $ndi_title;
  121.             if ($id == "inf") $colour = "#000096";
  122.             elseif ($id == "exp") $colour = "#966400";
  123.             elseif ($id == "coc") $colour = "#960000";
  124.             elseif ($id == "com") $colour = "#646400";
  125.             elseif ($id == "sys") $colour = "#006400";
  126.  
  127.             if ($ndi_title == $name) {
  128.                 echo "<TD valign='middle'";
  129.                 echo " class=menu style='background-color:$colour;'";
  130.                 echo " onMouseOver=\"this.style.backgroundColor='$colour'; this.style.cursor='hand';\"";
  131. //                echo "onMouseOut=\"this.style.backgroundColor=''\"";
  132.             } else {
  133.                 echo "<TD valign='middle'";
  134.                 echo " class='$id menu'";
  135.                 echo " onMouseOver=\"this.style.backgroundColor='$colour'; this.style.cursor='hand';\"";
  136.                 echo " onMouseOut=\"this.style.backgroundColor=''\"";
  137.             }
  138.             if ($name != "realtime") echo "onclick=\"window.location.href='$to'\">";
  139.             else echo ">";
  140.             echo "<A href='$to'>";
  141.             echo "&nbsp;&nbsp;&nbsp;$name&nbsp;&nbsp;&nbsp;";
  142.             if ($ndi_title1 != $name) echo "</A>";
  143.                 echo '</TD>';
  144.         }
  145.  
  146.         function create_menu_div ($id) {
  147.             global $u;
  148.             echo "<DIV id='$id'><TABLE border=0 cellspacing=0 cellpadding=0><TR>";
  149.             if ($id == "inf") $colour = "#000064";
  150.             elseif ($id == "exp") $colour = "#643200";
  151.             elseif ($id == "coc") $colour = "#640000";
  152.             elseif ($id == "com") $colour = "#323200";
  153.             elseif ($id == "sys") $colour = "#003200";
  154.             topbutton("information","inf",$id,"#000064");
  155.             topbutton("expansion","exp",$id,"#643200");
  156.             topbutton("command control","coc",$id,"#640000");
  157.             topbutton("communication","com",$id,"#323200");
  158.             topbutton("system","sys",$id,"#003200");
  159.             echo '</TR></TABLE><TABLE border=0 cellspacing=0 cellpadding=0 width=100%><TR>';
  160.  
  161.             if ($id == "inf") {
  162.                 button("overview","inf","overview");
  163.                 button("news","inf","news");
  164. //                button("planet", "inf", $u['coords']);
  165. //                button("universe","inf","universe");
  166.                 button("universe","inf",$u['coords']);
  167.                 button("rankings","inf","rankings");
  168.             } elseif ($id == "exp") {
  169.                 button ("research","exp","rd?r=1");
  170.                 button ("develop","exp","rd?d=1");
  171.                 button ("resources","exp","land");
  172.             } elseif ($id == "coc") {
  173.                 button ("fleets","coc","military");
  174.                 button ("create","coc","create");
  175.                 button ("scans","coc","scans");
  176.                 button ("items","coc","items");
  177.             } elseif ($id == "com") {
  178.                 button ("messages","com","messages");
  179.                 if ($u['sp_ban'] != "forums") {
  180.                     button ("forums","com","forums");
  181.                 }
  182.                 button ("realtime","com",'javascript:void window.open("realtime","realtimewindow","width=800,height=600,resizable=1,scrollbars=no,menubar=no,status=no");');
  183.                 button ("affairs","com","affairs");
  184.                 button ("alliances","com","alliances");
  185.                 button ("auctions","com","auctions");
  186.             } elseif ($id == "sys") {
  187.                 button ("preferences","sys","prefs");
  188.                 button ("search","sys","search");
  189.                 button ("profile","sys","profile");
  190.                 button ("logout","sys",$GLOBALS[evo_mainsrv]."logout.php");
  191.             }
  192.  
  193.             echo "<TD width=100% style='background-color:$colour;'></TD></TR></TABLE></DIV>";
  194.         }
  195.  
  196.         echo '<DIV id=container class=main>';
  197.             create_menu_div("inf");
  198.             create_menu_div("exp");
  199.             create_menu_div("coc");
  200.             create_menu_div("com");
  201.             create_menu_div("sys");
  202.         echo '</DIV>';
  203.  
  204.         if ($error) echo "<table cellspacing=0 width=100%><tr><td width=0 class=error>Sorry:</td><td align=center class=error>$error</td></tr></table>";
  205.         ?>
  206.         <script language="JavaScript">
  207.             loadLyr('<?
  208.                 if ($ndi_title == "research" || $ndi_title == "develop" || $ndi_title == "resources")
  209.                     echo 'exp';
  210.                 elseif ($ndi_title == "fleets" || $ndi_title == "create" || $ndi_title == "scans" || $ndi_title == "items")
  211.                     echo 'coc';
  212.                 elseif ($ndi_title == "messages"|| $ndi_title == "forums" || $ndi_title == "realtime" || $ndi_title == "affairs" || $ndi_title == "alliances" || $ndi_title == "auctions")
  213.                     echo 'com';
  214.                 elseif ($ndi_title == "preferences")
  215.                     echo 'sys';
  216.                 else
  217.                     echo 'inf';
  218.             ?>');
  219.         </script>
  220.  
Right now, the code is getting overhualed (OOP, CSS styling, etc.), and I want a nice looking navbar to go with it. I tried once before to convert it over, but it failed. And since how poorly layed out his code is, it's hard to understand for me and my lacking PHP knowage. Anyways, any way to make a simple navbar (google doesn't help much with this) or even a point in a direction that can help is nice.

--HACKhalo2
Jul 31 '08 #1
1 1816
pbmods
5,821 Recognized Expert Expert
Heya, HACKhalo2.

What is your code doing currently that you don't want it to do?
Jul 31 '08 #2

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

Similar topics

5
by: Willam Roberts | last post by:
To me, when you enumerate, you make a list of specific items, like enumerating controls in a form. Am I missing something? I mean is there something more to the meaning of the term "enumeration" or...
31
by: CYBER | last post by:
Hello Is there any other way under python to create blocks ?? instead of def sth(x): return x
2
by: Stewart | last post by:
Originally posted in comp.lang.javascript: Newsgroups: comp.lang.javascript From: "Stewart" Date: 23 Aug 2005 02:50:04 -0700 Local: Tues, Aug 23 2005 10:50 am Subject: FireFox, RemoveChild,...
7
by: redneon | last post by:
Does anyone have any good links to information on how it's possible to make a library in C++? I can't seem to find anything.
90
by: Ben Finney | last post by:
Howdy all, How can a (user-defined) class ensure that its instances are immutable, like an int or a tuple, without inheriting from those types? What caveats should be observed in making...
34
by: Asfand Yar Qazi | last post by:
Hi, I'm creating a library where several classes are intertwined rather tightly. I'm thinking of making them all use pimpls, so that these circular dependancies can be avoided easily, and I'm...
351
by: CBFalconer | last post by:
We often find hidden, and totally unnecessary, assumptions being made in code. The following leans heavily on one particular example, which happens to be in C. However similar things can (and...
10
by: JurgenvonOerthel | last post by:
Consider the classes Base, Derived1 and Derived2. Both Derived1 and Derived2 derive publicly from Base. Given a 'const Base &input' I want to initialize a 'const Derived1 &output'. If the...
7
by: MarkNeumann | last post by:
I'm coming from a Corel paradox background and moving into an Access environment. So I'm struggling with something that I think is probably way simpler than I'm making it out to be. Access 2007...
50
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.