473,763 Members | 6,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4051
<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.javas cript:
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.c om, 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/googlegroupsrep ly/>

--
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
3055
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 functions defined which know how to read the hardware sensorts. I access it from wherever I am via any browser, and it displays the measurements (a set of simple numbers) as Java applets in a simple html page. One entry in this page (a table cell) looks...
13
28005
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 i;for(i=0;i<39;putchar(s-1));return 0;}
1
1632
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 to have a button that compiles that code and if there are errors to show them up,,,,, So far I'm planing to use the Sun javac.exe. So my question is " Does anyone know how to call JavaC.exe & retrieving the
5
2069
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 System.Diagnostics.Process.Start() but the console application was launched too. I want to compile and retrieve the errors/messages without lauching another app and showing the errors/messages in within my winform.
4
2509
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. I AM USING TOMCAT 4.1 WEBSERVER FOR COMPILING JSP PAGES.
4
3363
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 way for me? the simple and speediness choice the better. thanks.
4
2221
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 please talk me through it? (PS I've starred out parts of it as they are private to my company!) POST /*****/*****.asmx HTTP/1.1 Host: localhost Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0"...
1
2835
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 simulates a point-of-sale (POS) system. Customers buy books. To simplify, you may want to limit that a customer can buy only a maximum of 5 books for each transaction. However, the program will be better if a customer can buy and pay for any number of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10144
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9937
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.