Astahost.com   Mar 21, 2010
Open Discussion & Free Web Hosting > Computers & Tech > Designing > Web Design and HTML
Pages: 1, 2

Need Help With JS/CSS Dropdown Menu

free web hosting

Read Latest Entries..: (Post #11) by iGuest on May 24 2008, 07:04 PM.
css textbox Need Help With JS/CSS Dropdown Menu Css textboxt input (textfield) style - examples - - Http://www.Css-lessons.Ucoz.Com/textbox-css-examples.Htm-reply by chester
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion & Free Web Hosting > Computers & Tech > Designing > Web Design and HTML

Need Help With JS/CSS Dropdown Menu

miCRoSCoPiC^eaRthLinG
Hey guys,
I'm helping out a friend in designing a site for his business and got stuck with JS/CSS Dropdown menu. Searching around I found one of the easiest to implement scripts at Dynamic Drive.

I managed to implement the script partially, i.e. got the top menu showing up. Looked good so far. Here's the screenshot:
IPB Image

After defining the menu divs, you're supposed to call the script that performs the dropdown action using a code like this:
CODE

<script type="text/javascript">cssdropdown.startchrome("name_of_main_menu_div");</script>


When I call the function, my page layout gets totally garbled and the dropdown function never works. Here's how it looks like...
IPB Image

Do the web-design pros out here have an idea why it's getting messed up like this ? The example layout can be viewed at: http://gaute.chaos-laboratory.com
Also attached along with this post is a zip containing the site files so far.

Any help will be greatly appreciated.

Cheers,
m^e

Site Files: Click to view attachment

 

 

 


Comment/Reply (w/o sign-up)

pyost
There are just two things that need to be fixed, both in the index.html file. First of all, let's take a look at the header. Over there, you load the JavaScript file that contains the necessary function. You used the following code:

CODE
<script type="text/javascript" src="js/chrome.js">


However, this way, the text that goes after (including a big part of the HTML code) is inside the <script> tag and considered JavaScript. That's why you need to close the tag in the header:

CODE
<script type="text/javascript" src="js/chrome.js"></script>


OK, so we've got the whole page being displayed, but it's still not working. Why? Another JavaScript problem, except now it's about calling the function. After the menu, you did it like this:

CODE
<!-- <script type="text/javascript">cssdropdown.startchrome("chromemenu");</script> -->


As you probably know, <!-- and --> are used to indicate comments or code that will not be displayed/executed. By removing these, you get a fully functional menu smile.gif

CODE
<script type="text/javascript">cssdropdown.startchrome("chromemenu");</script>


There is one more thing, though. I'm sure you didn't put those comments without a reason - yes they should be around there, but like this:

CODE
<script type="text/javascript">
<!--
cssdropdown.startchrome("chromemenu");
-->
</script>


We have to do this in order to deal with browsers that don't support JavaScript. Be careful, the code must be just like this, with a new line for each element, otherwise it would again be a comment, if you put it like this:

CODE
<script type="text/javascript">
<!-- cssdropdown.startchrome("chromemenu"); -->
</script>


Since the starting and ending point for the comment are alone and in separate lines, a JavaScript browser will ignore them because those are not JS commands. Older browsers will comment the JS function, because they don't recognize the <script> tags.

 

 

 


Comment/Reply (w/o sign-up)

..::FoH::..Adm.HiDdEn
Hey, Post here the CSS script

Comment/Reply (w/o sign-up)

pyost
You have in the file attached with the first post, but the problem is (I believe) already solved smile.gif

Comment/Reply (w/o sign-up)

TavoxPeru
Great job pyost, first i try directly the code and nothing works, after make the corrections you give it works perfectly. Now, if you plan to validate your website to be xhtml 1.1 you need to remove the comment tags because if you dont your page do not pass the validation process and also, if you plan to be a valid xhtml 1.0 then you need to do some little modifications to conform the validation. The first modification you need to perform is to declare correctly the DOCTYPE because it is not correctly typed, you need to change this:

CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

to this:

CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

BTW, m^e thanks for your code, i will modify it to use on another website, but dont worry, i will only use your page structure because is very simple and clean, not your data wink.gif

Best regards,

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
Damn guys - that was such a silly blunder and got fixed in one go biggrin.gif Thanks to all of you... However, I'll be back with more questions soon.

As of now, there's an issue with the site - do you know of any way to fix the footer below ? What I mean is that, if I stuff in a lot of content in the Center column, it expands below and covers up the footer. What's the CSS trick, that'll make it move down along with the content ??

Comment/Reply (w/o sign-up)

pyost
Ugh.. The way you created the layout is a bit confusing unsure.gif I am sure the problem can be easily solved if you used floats for the sidebar. This way, however, I cannot think of a solution.

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
Hmmm.. what's the float story ?? Any way I can modify my css and make the sidebars float instead??

Comment/Reply (w/o sign-up)

pyost
Take a look at this page for more information concerning positioning your sidebars with float:left and float:right properties:
http://www.shadow-fox.net/tutorial/3-Colum...and-Two-Columns

When you do so, you will need to add clear:both to your footer in order for it to be at the end of all the columns.

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
I got the 3 column layout from one of the CSS Tutorial sites and the biggest advantage of my layout is that the Center column comes up first. That is a MUST if you're concerned about SE-Optimization of your pages.

The layout you've shown makes the two side columns come up first. Crawlers don't like that kinda sites tongue.gif Otherwise it'd have been a good layout.

Any alternatives ???

Comment/Reply (w/o sign-up)

Latest Entries

iGuest
css textbox
Need Help With JS/CSS Dropdown Menu

Css textboxt input (textfield) style - examples - -
Http://www.Css-lessons.Ucoz.Com/textbox-css-examples.Htm

-reply by chester

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : js, css, dropdown, menu

  1. Help With Menu Using CSS
    (14)
  2. Creating Expanding Menu Tree In A Web Page
    sharing my knowledge (7)
    hey guys... im here to share some tricks i picked up along the way in creating or designing web
    pages... this trick is making an expanding tree menu like the one you can find in the Windows
    Explorer.. very cool eh! the trick is done by using javascript and some of its objects.. so here we
    go Lets say for example you want to create this tree menu Fruits Apple Small
    Medium Large Grapes With seeds Seedless Banana Green Yellow and
    you want to make this menu collapse or expand when click the first we do is encode this smal....
  3. Php: How To Make A Menu With Images ?
    Help needed (6)
    i try to make a site and i know html but i don't understand php, can somebody post some
    code's? know somebody how you must make a menu in php with images at it, etx.....
  4. How Can I Change The Colors Of A Drop-down Menu?
    using css or some other ways (3)
    Hi guys, si ther anyone who can help me with modifying the color of my dropdown menu form? I used
    css in textboxes, and other things also.....
  5. Dropdown Box ?
    (1)
    Hey...I posted this same thing in another forum. I was wondering if anyone here knows how to make a
    dropdown box refresh the page after having a value change. In other words: I have a site, and I
    want to make it so that the main page displays news. I will have the news in a mySQL database, and I
    want it so that the main page contains a dropdown box with every possible date from the site's
    creation to the current date. When you change the value, the page refreshes and displays that
    day's news on the main page.....
  6. Drop Down Menu Help
    (8)
    ok i have a bunch of buttons, and I want it so when the mouse goes over it a drop down menu appears,
    so I have no idea how to code like that, all the buttons including the drop down part are in .gif
    format soo tell me if this is possible, thank you /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" />....
  7. Rollover Menu Problems
    After visited, hover doesn't work! (2)
    Here's my problem: I have a simple rollover menu, where the links light up whenever your mouse
    is over one of them. It works fine. In the simplest sense, I used this CSS code: (in .css file)
    a:link, a:visited {color:#000000} a:hover {color:#FF0000} This works! Yay! Okay. But when
    I click on any of the links (it is therefore considered "visited"), the hover function doesn't
    work anymore. The link becomes static (hover does not work anymore). And yes, I want my unvisited
    and visited links to be the same color. Question: How do I get the hover functi....
  8. Creating Dhtml Menu
    do you know how to create cool menu? (2)
    I've searching for a while, but never could find the best solutions for menu design. could
    anyone tell me where to find the best site that provide DHTML menu creation?.....
  9. What Is The Best Javascript Menu Builder?
    (7)
    I really need a free, cool and easy-to-integrate JAVASCRIPT menu builder for my new site. I mean
    free to use as in unlimitated use provided i link the producer's site to my menu. Anyway if
    someone knows anything pleas help. Thanks !!....
  10. how do u make menu?
    dynamic menu (21)
    for the site i am building i need one so can some one tell me where to find one or a code of one?....

    1. Looking for js, css, dropdown, menu



See Also,

*SIMILAR VIDEOS*
Searching Video's for js, css, dropdown, menu
advertisement




Need Help With JS/CSS Dropdown Menu

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com



Creative Commons License