473,388 Members | 1,552 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

WRITE JAVA CODE

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.

Feb 25 '06 #1
4 3993
<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>

Feb 25 '06 #2
Khan wrote:
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 <body> tag.
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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Feb 25 '06 #3
ghlex, i tried that but nothing hapenning , on bottom of page the
message is "error on page".

Feb 25 '06 #4
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/>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Michael Levin | last post by:
I've got the following problem. I'm a biologist and I have a device at work which monitors my frog habitat. The device has a bunch of sensors, and runs an embedded html server with some java...
13
by: Ravi | last post by:
Do we have anything that could convert C++ code to java code? To what extent are such tools reliable? TIA. -- main(){char s="sbwjAeftqbnnfe/dpn!ps!CSbwjACjhgppu/dpn"; int...
1
by: genc ymeri | last post by:
Hi, I'm coding a C# Win Application. Somehow we need to let the "end-users" of our application to write some Java code in one of our app's winform called : "Coding". What I would like to do is...
5
by: genc ymeri | last post by:
Hi overthere, I'm trying to compile some Java code within a C# application form. So the end user will write his/her code in a textbox and a button compile will compiles it. I tried to use...
4
by: mjahabarsadiq | last post by:
HELLO FRIENDS I HAVE ONE JAVA CODE WHICH PARSES AN XML FILE AND PRODUCE A QUERY TO CREATE TABEL IN A DATABASE. BUT I NEED THE CODE TO BE USED IN A JSP PAGE. HOW TO USE THIS PAGE WITH JSP. ...
4
by: momobear | last post by:
A friend of my write a Java program, and I want use it in my python program as a module. I searched the topic in Google and find maybe the better way is use GCJ to compile it. Is there any other...
4
by: moorcroft | last post by:
Hi, I'm new to using SOAP so apologies for any ignorance on my part! I'm trying to write java code to create the following SOAP message and return message, and am wondering if someone could...
1
by: chean | last post by:
The question Cik Mat operates bookstore. During their promotion period, there are books which are sold with special discounts, while others are sold at normal price. Write a program which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.