473,499 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Java/HTML buttons and forms help

5 New Member
I used to know how to do this, but I lost alot of my old files on my old computer.

I'm trying to create a page that has different buttons on top (I know how to create the buttons), but then depending on which button is clicked, I want it to post text to a textarea. It would have to be a textarea because the text being posted is html code. I would appreciate any and all help. Thanks!

Karyn
Dec 7 '06 #1
3 1304
mharrison
26 New Member
I used to know how to do this, but I lost alot of my old files on my old computer.

I'm trying to create a page that has different buttons on top (I know how to create the buttons), but then depending on which button is clicked, I want it to post text to a textarea. It would have to be a textarea because the text being posted is html code. I would appreciate any and all help. Thanks!

Karyn
If you are trying to do something with buttons and javascript, heres an idea. Not sure if it's exactly what you want.....

Paste this HTML code into a text editor and save as a HTML page:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  3. "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6.  
  7. <script type="text/javascript" >
  8.  
  9. function pasteCode(e) {
  10. var Code = "";
  11. if(e.name == "But1") {
  12. Code = "You chose the BODY section of this page\n <body>\n<form name='buttonForm' action=''>\n</form>\n</body>"
  13. document.buttonForm.codeDisplay.value =Code;
  14. }
  15. if(e.name == "But2") {
  16. Code = "You chose the HEAD section of this page\n <head></head>"
  17. document.buttonForm.codeDisplay.value =Code;
  18. }
  19. if(e.name == "But3") {
  20. var Code = "You chose the NO CODE section of this page. Hit another one please....."
  21. document.buttonForm.codeDisplay.value =Code;
  22. }
  23. if(e.name == "But4") {
  24. var Code = "OK you get the idea now don't you!"
  25. document.buttonForm.codeDisplay.value =Code;
  26. }
  27.  
  28. }
  29.  
  30.  
  31. </script>
  32. <title>Button fun</title>
  33. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  34. </head>
  35.  
  36. <body>
  37. <form name="buttonForm" action="">
  38. <input name="But1" type="button" value="#1 - Click me!" onClick="pasteCode(this)">
  39. <input name="But2" type="button" value="#2 - Click me!" onClick="pasteCode(this)">
  40. <input name="But3" type="button" value="#3 - Click me!" onClick="pasteCode(this)">
  41. <input name="But4" type="button" value="#4 - Click me!" onClick="pasteCode(this)">
  42.  
  43. <input type="reset" name="reset" value="Reset"/>
  44. <br/>
  45. <br/>
  46. <textarea name="codeDisplay" cols="100" rows="30">Hit a button and see what HTML stuff gets posted....</textarea>
  47. </form>
  48. </body>
  49. </html>
  50.  
Dec 7 '06 #2
karyn420
5 New Member
thank you very much! that's exactly what I was looking for :)
Dec 7 '06 #3
karyn420
5 New Member
ok, that works when i preview it in my editor, but then when i actually go to the website, it doesn't work... :(
www.geocities.com/hottieinyourdreams420/main.html
Dec 7 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1769
by: Martin | last post by:
Hi All, I am a relative newbie to Java / Applets, but am despirately after some help ! I have got the following code, which is basically a listing with button items along the sides, allowing...
73
7892
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities...
5
29416
by: java_helloworld | last post by:
I am trying to print from an applet using the Java Print API. If I run the applet on appletviewer then things work fine i.e. I am able to get the print out. If I run the applet on a browser then...
12
6505
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
11
9208
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
2
1497
by: Efkas | last post by:
Hi I am a new c# programmer since my project let java on the tablet to do programming on windows. I was building an application all customized. I had : 1. my own custom widgets (text areas,...
5
1523
by: Edwinah63 | last post by:
Hi everyone, i was wondering if anyone else had observed this and if there is any workaround or patch. i have some screens (an mdi child forms) with the buttons &Add, &Edit, &Save and E&xit,...
4
1980
by: Sathyaish | last post by:
I am no JavaScript progammer, and unfortunately am having to babysit an old code base that has a lot of JavaScript in it. I have two questions: (1) Can two HTML controls have the same name? It...
2
1048
by: karyn420 | last post by:
I used to know how to do this, but I lost alot of my old files on my old computer. I'm trying to create a page that has different buttons on top (I know how to create the buttons), but then...
0
7131
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
7174
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
7220
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...
0
7388
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...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1427
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 ...
0
297
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...

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.