Results 1 to 2 of 2
  1. #1
    jdigger is offline Member
    Join Date
    Feb 2011
    Posts
    3
    Rep Power
    0

    Question Calling function in Javascript- from other function

    I was just wondering how this statement is working in javascript.
    this.toString = toString;

    calling a function from the other function, up to my knowledge should be like : this.toString = toString();, but this is not working.

    Any idea?


    function Car()
    {
    this.make = new Array();
    this.colors = new Array();
    this.price = new Array();
    this.year = new Array();
    this.model = new Array();

    this.toString = toString;
    }

    function toString()
    {
    return ("Make: " + this.make "\n" "Color: " this.colors "\n" "Year: " this.year "\n" "Model: " this.model "\n" "Price: " this.price "\n");
    }

    Could some one please clarify on this?

    Thank you

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

    Default

    Your best bet is to ask this question in a JavaScript forum, not a Java forum as they are about as similar as ham is to hamster, and Google can help you find plenty of these forums. Since this question is not within the context of the forum, I am going to lock this thread.

Similar Threads

  1. How to pass a javascript function into APPLET PARAM
    By Ambergahill in forum Java Applets
    Replies: 0
    Last Post: 11-28-2010, 04:57 PM
  2. Set DIV tag using javascript function
    By mjwoodford in forum Advanced Java
    Replies: 1
    Last Post: 03-01-2010, 07:08 PM
  3. Calling the Function again
    By Swetz55 in forum New To Java
    Replies: 2
    Last Post: 12-19-2009, 11:10 AM
  4. Calling a generated GUI function
    By dejos456 in forum New To Java
    Replies: 5
    Last Post: 12-09-2009, 07:02 PM
  5. scriplet in javascript function in jsp page
    By Renjini in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 05-21-2008, 01:07 PM

Posting Permissions

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