Results 1 to 5 of 5

Thread: Novice at JAVA

  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Novice at JAVA

    I am trying to use a JAVA script to create menus where the items will drop down. I inserted the script into the <Head> section of the HTML section of my FrontPage page. I used the following event handler <body onload="init()" >. I then loaded the navcond.js script into the web's root directory. Then uploaded the whole thing to my web server in the office.

    Results is that the script inserted into the head of the document shows up as text on the page. I get a run time error that breaks at the <body onload="init()" > tag.

    On the page options JAVA script is active. I also did the Add JAVA applet. All that did was add a gray box to the page when it was published.

    Any help would be appreciated. Thank you.

    Fay

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Novice at JAVA

    There are several examples here at <A target="_blank" HREF=http://www.dynamicdrive.com/dynamicindex1/>Dynamic Drive</A> that may help - otherwise it may be easier if you could attach the page.

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Novice at JAVA

    Thank you Leif for your response. Actually the code I was using was from Dynamic Drive for the Top Navigational Bar II.

    I have attached the file. Okay that didn't go through so I will do the tried and true copy/paste method. Thanks! Fay

    <html>
    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    <applet width="128" height="128" code="navcond.js" codebase="www.awarenessproductions.com/">
    </applet><script language="JavaScript"
    src="navcond.js"></script></p>
    <p class=MsoNormal><script language="JavaScript"></p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>/*</p>
    <p class=MsoNormal>Top Navigational Bar II (By <st1:PersonName><st2:GivenName>Mike</st2:GivenName>
    <st2:Sn>Hall</st2:Sn></st1:PersonName>)</p>
    <p class=MsoNormal>Last updated: 00/05/08</p>
    <p class=MsoNormal>Permission granted and modified by Dynamicdrive.com to
    include script in archive</p>
    <p class=MsoNormal>For this and 100's more DHTML scripts, visit
    http://dynamicdrive.com</p>

    <p class=MsoNormal>*/</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>var myNavBar1 = new NavBar(0);</p>
    <p class=MsoNormal>var dhtmlMenu;</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>//define menu items (first parameter of NavBarMenu specifies
    main category width, second specifies sub category width in pixels)</p>
    <p class=MsoNormal>//add more menus simply by adding more "blocks" of
    same code below</p>

    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>dhtmlMenu = new NavBarMenu(100, 0);</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Home",
    "http://www.awarenessproductions.com.com"));</p>
    <p class=MsoNormal>myNavBar1.addMenu(dhtmlMenu);</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>dhtmlMenu = new NavBarMenu(100, 120);</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Documentation",
    ""));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Books",
    "http://www.cnn.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("MSNBC",
    "http://msnbc.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("ABCNews",
    "http://www.abcnews.com"));</p>
    <p class=MsoNormal>myNavBar1.addMenu(dhtmlMenu);</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>dhtmlMenu = new NavBarMenu(110, 120);</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Technology",
    ""));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("News.com",
    "http://www.news.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Techweb",
    "http://www.techweb.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Wired",
    "http://www.wired.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("<st1:Street><st1:address>Dynamic
    Drive</st1:address></st1:Street>",
    "http://www.dynamicdrive.com"));</p>
    <p class=MsoNormal>myNavBar1.addMenu(dhtmlMenu);</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>dhtmlMenu = new NavBarMenu(100, 150);</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Search",
    ""));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Yahoo",
    "http://www.yahoo.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("<st1:PersonName><st2:GivenName>Alt a</st2:GivenName>
    <st2:Sn>Vista</st2:Sn></st1:PersonName>",
    "http://www.altavista.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Infoseek",
    "http://www.infoseek.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Excite",
    "http://www.excite.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("HotBot",
    "http://www.hotbot.com"));</p>
    <p class=MsoNormal>myNavBar1.addMenu(dhtmlMenu);</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>dhtmlMenu = new NavBarMenu(100, 150);</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Webmaster",
    ""));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("<st1:Street><st1:address>Dynamic
    Drive</st1:address></st1:Street>",
    "http://dynamicdrive.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Website
    Abstraction", "http://wsabstract.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("Freewarejava.com",
    "http://freewarejava.com"));</p>
    <p class=MsoNormal>dhtmlMenu.addItem(new NavBarMenuItem("BrainJar",
    "http://brainjar.com"));</p>
    <p class=MsoNormal>myNavBar1.addMenu(dhtmlMenu);</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>//set menu colors</p>
    <p class=MsoNormal>myNavBar1.setColors("#000000",
    "#000000", "#C0C0C0", "#ffffff", "#666666",
    "#000000", "#cccccc", "#ffffff",
    "#000080")</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>//uncomment below line to center the menu (valid values are
    "left", "center", and "right"</p>
    <p class=MsoNormal>//myNavBar1.setAlign("center")</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>var fullWidth;</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal>function init() {</p>
    <p class=MsoNormal><o>*</o></p>
    <p class=MsoNormal><span style='mso-spacerun:yes'>

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Novice at JAVA

    One of the first things I learnt about java is how incredibly fussy it is about punctuation.

    If you compare the text you posted with the text at the Dynamic Drive site, you'll see that MS Office has added a whole bunch of stuff that wasn't there on the site. This included various hard paragraph breaks (as well as well as possibly line breaks) which java interprets totally differently from HTML. If in doubt, don't break a java line.

    If I took your posted text, I simply got a blank page with the grey box. If I pasted the whole script that was posted at the Dynamic Drive site into a text editor, followed the steps advised and put <html> <head> at the beginning and </head> before the body tag and </body> </html> at the end, I got the attached. (You need to change the extension from ".txt" to ".html" and then it should display in your browser.)

    Working with a text editor is a bit tedious, but you can get TextPad or UltraEdit - both of which have colour coding. Personally, I found that MS Office HTML is acceptable either if you are prepared to work totally WYSIWYG (and are prepared to accept its idiosyncracies) or if you are a fairly experienced user. There have been some fairly high quality freeware HTML editors that don't add all sorts of bits to your code. The other alternative is to go back over what MS Office has saved for you, by opening the file in Notepad, compare it to what is on the website and take out everything that has obviously been inserted (including line breaks) into what was on the website. (This means (virtually -see above) all of the MS Office additions to the page after the </title> tag.)

    Hope this helps. (BTW you forgot to post the supporting script page to which your post referred.)
    Attached Files Attached Files
    Gre

  5. #5
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Novice at JAVA

    unkamunka That did it. Thank you! It is always the little things that get you. I tried sending the file but got a message that it couldn't be sent.

    Happy Holidays. Fay

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •