WRITE JAVA CODE

K

Khan

hi,

i'm writing java code inside <body> tag of java script file. all the
java code is executing at frame startup. how can i call that java code
only when i click on a button.
I can call jscript function on button click , but i want to call java
code on button click.

advise some solution.

Many Thanx.
 
G

ghlex

<script>
function test() {
// enter your java code here
}
</script>

<html>
<head></dead>
<body>
<input type="button" onClick="test();">
</body>

Thid will work.Have fun.:D
</html>
 
D

David Dorward

Khan said:
i'm writing java code inside <body> tag of java script file.

Two problems there...

1. A JavaScript file should contain JavaScript, not Java. Java and
JavaScript are two entirely different languages.

2. A JavaScript file should contain JavaScript, not HTML, so there should be
no said:
all the java code is executing at frame startup.

It's actually executing? I'm amazed. Perhaps you mean "JavaScript" when you
say "java", and there is some error correction going on to correct the
markup you've put there.

Oh - http://allmyfaqs.net/faq.pl?Problems_with_using_frames
how can i call that java code only when i click on a button.

Wrap it in a function. Call that function from the onClick hander of the
button.
I can call jscript function on button click , but i want to call java
code on button click.

Now I'm really confused. You can do this with Microsoft's JScript language,
but not JavaScript? Or you really do have some Java around? Or you are
using scripting to play with publically exposed methods of a Java applet?

Providing a URL might make it easier for people to help you. Preferably a
minimal test case.
 
K

Khan

ghlex, i tried that but nothing hapenning , on bottom of page the
message is "error on page".
 
E

Evertjan.

Khan wrote on 25 feb 2006 in comp.lang.javascript:
ghlex, i tried that but nothing hapenning , on bottom of page the
message is "error on page".

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the article
headers. <http://www.safalra.com/special/googlegroupsreply/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top