Results 1 to 6 of 6

Thread: Accessing external .js from .htm [Resolved]

  1. #1

    Thread Starter
    Member Evolute's Avatar
    Join Date
    Sep 2002
    Location
    Portugal
    Posts
    58

    Accessing external .js from .htm [Resolved]

    How can I use an class to access it from by web page?

    Code:
    <INPUT value='0' type="text" onBlur="format(txtbox.value);" name="txtbox">
    the format() class is an external class

    Thanks
    Last edited by Evolute; Mar 12th, 2003 at 10:25 AM.
    Evolute

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    Is format a class or a function?

    Code:
    <script src="../MyFunctions/StringManip.js"></script>
    Where StringManip contains the format function.

  3. #3

    Thread Starter
    Member Evolute's Avatar
    Join Date
    Sep 2002
    Location
    Portugal
    Posts
    58
    format() is an external function

    I have a web page where I have this tag:

    Code:
    <INPUT value='0' type="text" onBlur="format(txtbox.value);" name="txtbox">
    Now I have a file called: format.java
    This file has a function:

    VB Code:
    1. public class formata(msg){
    2.    ...;
    3.    ...;
    4. }


    How can i link the two parts?

    Thanks!
    Last edited by Evolute; Mar 12th, 2003 at 09:50 AM.
    Evolute

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Do you mean a Java class file? If so, and you have already added the applet to your html file, i.e.:
    Code:
    <APPLET NAME="myapplet"  
            CODE="myJavaClass.class" 
            HEIGHT="250" WIDTH="600">
    </APPLET>
    Then recode your call as:
    Code:
    <INPUT value='0' type="text" onBlur="myapplet.format(txtbox.value);" name="txtbox">

  5. #5

    Thread Starter
    Member Evolute's Avatar
    Join Date
    Sep 2002
    Location
    Portugal
    Posts
    58
    No.. it's no an applet. What I have in the .html file is this:

    Code:
    <HTML>
    <BODY>
    	<TEXTAREA name="textarea" rows=12 cols='15' style="TEXT-ALIGN: right"></TEXTAREA>
    	<BR>
    	<INPUT value='0' type="text" onBlur="format(txtbox.value);" name="txtbox">
    </BODY>
    </HTML>
    And, in another file I have this:

    Code:
    public class formata(msg){
       ...;
       ...;
    }
    Evolute

  6. #6
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    Java != Javascript

    Are you using Java or Javascript if it's the latter..

    change the format.java to format.js

    with formata drop the public class bit for function formata(msg){...}

    <script src="format.js">

Posting Permissions

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



Click Here to Expand Forum to Full Width