|
-
Mar 12th, 2003, 07:54 AM
#1
Thread Starter
Member
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
-
Mar 12th, 2003, 08:04 AM
#2
Is format a class or a function?
Code:
<script src="../MyFunctions/StringManip.js"></script>
Where StringManip contains the format function.
-
Mar 12th, 2003, 09:35 AM
#3
Thread Starter
Member
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:
public class formata(msg){
...;
...;
}
How can i link the two parts?
Thanks!
Last edited by Evolute; Mar 12th, 2003 at 09:50 AM.
Evolute
-
Mar 12th, 2003, 09:46 AM
#4
Frenzied Member
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">
-
Mar 12th, 2003, 09:55 AM
#5
Thread Starter
Member
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){
...;
...;
}
-
Mar 12th, 2003, 10:03 AM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|