Results 1 to 2 of 2
  1. #1
    DanielOwsley is offline Member
    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Default Java and Html issue

    Making a webpage and trying to use java to make the site a bit more managable. I'm new to both languages.
    Here's my java file I'm trying to run




    //Comic.js

    var Index= 0;

    var NumComics = 1;

    var ComicArray = new Array(NumComics);

    public class Comic {
    public int ComicNumber;
    public String ComicTitle;
    public String ComicDate;
    //constructor
    public Comic(int a, String t, String d)
    {
    ComicNumber = a;
    ComicTitle = t;
    ComicDate = d;
    }
    }


    function MakeArrays()
    {
    ComicArray[0] = new Comic(12001, "The Grass is Always Greener", "July 1 2012");
    }

    function WriteComicTitle()
    {
    MakeArrays();

    System.out.println(ComicArray[Index].ComicTitle);
    }




    Here's the html I'm using to do what needs to be done.




    <script type="text/javascript"src="Scripts/Comic.js">WriteComicTitle();</script>





    Other then the line above in my html, all the html code works (tables pics etc..) However my java is not running. Here's what I have accounted for already; file paths are all correct, I have gone over the sintax a dozens times. What am I doing wrong here. I'm an experienced c# and c++ if that helps anyone understand why I may be makeing a stupid mistake here. thanks in advance for the help.

    Dan
    Last edited by DanielOwsley; 07-02-2012 at 12:55 AM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Java and Html issue

    Quote Originally Posted by DanielOwsley View Post
    ... anyone understand why I may be makeing a stupid mistake here...
    Well, for one, you've asked your JavaScript question on a Java forum when you should be asking it on a JavaScript forum, since the two languages are not the same and in fact are very different. Fortunately Google can help you find your JavaScript forum. I will be locking this question soon as it is off topic for this forum. Best of luck with solving your problem.
    Last edited by Fubarable; 07-02-2012 at 01:07 AM.

Similar Threads

  1. Regular Expression issue and setName() method issue
    By geforce in forum New To Java
    Replies: 2
    Last Post: 01-30-2012, 03:33 AM
  2. html and java
    By dnbhead in forum New To Java
    Replies: 2
    Last Post: 12-13-2011, 06:40 PM
  3. Using HTML in java
    By hitmen in forum AWT / Swing
    Replies: 3
    Last Post: 02-26-2009, 05:58 AM
  4. Java + html
    By GabWit in forum New To Java
    Replies: 4
    Last Post: 01-25-2009, 03:58 AM
  5. How can I include a html file in html textarea?
    By surya_dks in forum New To Java
    Replies: 2
    Last Post: 10-04-2008, 07:20 AM

Tags for this Thread

Posting Permissions

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