Nov 20, 2009

Onclick Image ->> Add Text To Input(text)field?

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

Onclick Image ->> Add Text To Input(text)field?

gotcha41
when some images get clicked, a text should added to an input(textfield). Does someone know how this can be done? I suppose it can be done via javascript.
thanks in advance! cool.gif If you need more information, just ask tongue.gif

Comment/Reply (w/o sign-up)

whyme
gahhhh, i had a script like this, but then i completely lost it! I'm positive that you can find a script like that at hotscripts.com

dang it, i can't believe i forgot that script...

it's something like:

OnMouseClick then document.write something....


Comment/Reply (w/o sign-up)

SystemWisdom
That would be simple enough using the Document Object Model of HTML and JavaScript..

A javascript function could access nearly any element in the page, and at any time, so an image being clicked would be a good time!

Basically, how it works is by giving the element you want access to an ID with the id="" attribute. Then you can get a direct reference to that element by using the ID with the getElementById() function that is part of javascript. Once you have access to the element, you can change its Value property to display any text you want.

Wrap that in a function, and call it in the onclick event of an image.

Here is an example:

CODE


<html>

<head>

<title></title>

<script type="text/javascript" language="javascript"><!--

function ChgText()
{
   var MyElement = document.getElementById("MyTextBox");
   MyElement.value = "If you see this, it worked!";

   return true;
}

//--></script>


</head>

<body>

<br><br>
<center>
<img src="my_image.gif" alt="Click Me!" onclick="ChgText()" />

<br><br><br>

<input type="text" size="35" id="MyTextBox" value="" />

</center>

</body>
</html>


I hope that helps!

 

 

 


Comment/Reply (w/o sign-up)

gotcha41
ok, thanks ! You provided the code i was looking for wink.gif

this topic can be closed now? question answered/problem solved..

btw: Systemofwisdom, i've raised your reputation with one point ! cool.gif
keep up the good work. tongue.gif

Comment/Reply (w/o sign-up)

(G)Killswitch
Awesome
Onclick Image ->> Add Text To Input(text)field?

Thanks for supplying some code. I don't know much about Javascript ( just learning ) but do know PHP. I am building a custom CMS by myself and always need help on the Javascript end. I wanted to do the same, associate an image with a post by clicking a generated list of images to auto add the path. I had to add a parameter to the function but got it working great. -reply by Killswitch

Comment/Reply (w/o sign-up)

(G)Chip
Editable textarea
Onclick Image ->> Add Text To Input(text)field?

I was searching for an editable (html) textarea and landed on this page. The "Word" looking text editor that this question is created in is exactly what I'm looking for. Can anyone tell me where to get more info about it?

====================

Admin Reply - Is this what you were looking for?

The ultimate textarea replacement.
http://www.openwebware.com/

Finally, a free cross-browser WYSIWYG editor that's packed with every rich-text editing feature you need to make your content management system that much better.

TinyMCE - Javascript WYSIWYG Editor
http://tinymce.moxiecode.com/

TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances. TinyMCE is very easy to integrate into other Content Management Systems.


Comment/Reply (w/o sign-up)

(G)Doug
Works great, but how about if the form box was on a linked page?
Onclick Image ->> Add Text To Input(text)field?

Replying to SystemWisdom

Hi, I don't know what to even look for to do this. My company website has an agent profile and a contact page for me. I made 3 rollover buttons on my profile page, that when you click on them will link to the same company contact page. I'm trying to find the code that I could attached to each of my three buttons, so when they are clicked on they will each input something different in the same comment text box on the linked page. So than the customer can just fill in his name and number, and hit submit button with out typing in the comment box on what Service (Button clicked on) they are requesting more info on. If any one could help, I would be most thankful! So I have Web Page A & Web Page B (I can't add any text) - So I only have access to Web Page A WebPage A - Has 3 different buttons, each button when you click on them will go to the same URL WebPage B. WebPage B - is a unchangeable Submit Form page, were people can write Name # and Comment Text Area. Problem: What code could I use on Page A that has 3 different buttons, When you click on one of the 3 buttons on Page A, it would genterate a text related to that button in the comment text box field on Page B. This is what I've been looking for but I need the text to go to page B Comment Box -reply by Doug

 


Comment/Reply (w/o sign-up)

(G)Sakkie
Displaying an image before upload when it is selected via
Onclick Image ->> Add Text To Input(text)field?

Hi there.

Iam at wits end!!

I have written code that displays an image based upon the file selected from the input/upload functionality. But is only displays one file on my computer automatically and refuses to do the rest.

I use Javascript and set the scr attribute of the image through the eg;

document.GetElementById("MyPic").Scr=document.GetElementById("FUpload").Value;

Like I said I played around with is and it worked on one of the JPEG fles on my pc but refused any other fies, including JPEG files. What's wrong or am I missing the point altogether.

Regards Sakkie 

-question by Sakkie

Comment/Reply (w/o sign-up)

(G)Bobbi
how to add html to change text scriptlet
Onclick Image ->> Add Text To Input(text)field?

Replying to SystemWisdom Hi, I like this scriptlet. It is just what I needed, but have one problem. . .I want to add a link not just plain text in the MyElement value= but it just makes an error. Is there special way I should write this? Thanks. -question by Bobbi

Comment/Reply (w/o sign-up)

(G)Albert
how to rollover an image and show related text at the same time
Onclick Image ->> Add Text To Input(text)field?

I wonder how to use javascript to roll over an image and show related text at the same time.The image should swap when mouse over it but at the same time a text will show beside it.

thanks,..

-question by Albert

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : onclick, image, add, text, input, text, field

  1. Image Rotater
    need help (2)
  2. Text Image Java Problem
    How to include text and image in some scrollable container? (1)
    Hello everyone, I am just writing some kind of text editor as practice for some school project and I
    have come to certain point where I can not solve certain problem. I wanted to make it available
    for people to insert images but I cannot figure how to combine images and text and which container
    should I use. I am working in Java and using swing. Also I would like to say that this content
    should be scrollable. So if anyone knows something about this and could be able to help me thanks in
    advance. Everyone opinion is accepted.....
  3. How To Make This Type Of Link?
    Image change on mouseover (1)
    I cant figure out how to solve this problem.... I want to make link to be like this: When the page
    is loaded to have a pictures on it, but one picture is a link. I want to make this picture to change
    when I get my mouse cursor over her... I mean: when my mouse cursor is not on a picture then on page
    is loaded a "pic1.gif" file, but when my mouse cursor is over it, picture changes to a "pic2.gif".
    Thanks for help!....
  4. Help Writing An Html Code (onclick Open Something)
    (12)
    hi, I am new in web development i want to make a page in which there are few buttons and on click
    of each button there is some hidden text field which becomes visible and user can enter the text he
    wish to in it. how can i ?....
  5. How Do You Make Text In A <div> Change When You Click On A Link?
    something to do with jvascript (4)
    Say I have a link and some text. How would I make it so that when I clicked on the link, that text
    changed?....
  6. Expanding Image Gallery
    Images Expanding on a mousover (6)
    I was looking through wired today, and i noticed :
    http://www.hotwired.com/webmonkey/06/08/index2a.html looks like a pretty nifty image gallery
    effect, though i noticed that it wont display properly in FireFox. Does anyone have any links or
    examples of other image gallery code, i find it pretty fascinating.....
  7. Countdown Code Help
    I need help setting an image as the background. (3)
    Ok, now for scripts like this i am not to well of working with..and i am in need of a bit of help, i
    would like to set a background image as the background not a color... CODE /* Dynamic
    countdown Script- © Dynamic Drive (www.dynamicdrive.com) For full source code, 100's more DHTML
    scripts, and TOS, visit http://www.dynamicdrive.com */ function
    setcountdown(theyear,themonth,theday){ yr=theyear;mo=themonth;da=theday } //////////CONFIGURE THE
    COUNTDOWN SCRIPT HERE////////////////// //STEP 1: Configure the countdown-to date, in the format
    year, month, day: se....
  8. Link In Search Form
    Open a link inside a text area... (2)
    i added a javascript search to my site Search basically i wanted to have links on there so that
    when u click the link it runs the search. instead of making ppl type it into the textarea and
    clicking go. or have it so when u click the link it enters text into the text area and then
    searchs... anyone know what im chatting about? ~thanks Please make sure that Topic title has to
    be descriptive. ....
  9. Button To Display An Image
    (1)
    I have an assignment that is due tomorrow that I am struggling with. I want to be able to click the
    next button in this applet, and then repaint all the graphics. Board contains an array with all of
    the chess pieces on a board, and when the button is clicked I want to be able to get the next move,
    but for now I just wanted to call a function to move one piece just so I know it's working. Here
    is my applet code, I could post all the other files, but I am almost positive they all work
    correctly, and I am just having trouble with the applet. Code: CODE import java....
  10. Problem To Update Jlabel With A Different Image..
    (2)
    Hi All, I am inplementing a preview function on a image file browser. The application displays a
    list of image file names, which the user can select (one at a time). The preview image is loaded
    into a JLabel. When an image file name is selected, the application creates a thumbnail image on the
    hard drive call "preview.jpg". The JLabel should then update itself with the newly created thumbnail
    "preview.jpg". For some reason I cannot get the Image in the JLabel to update. I have confirmed
    that "preview.jpg" is being rewritten, each time a new image file is selected from ....
  11. Writing A Text File On Wen Host
    write to the text file on the webhost (1)
    Hi! i need to write a text file with applet on the wen host. It is like a guest book that the
    visitor enters his comments and the comments are stored in the text file. I found a website which
    presents a method to write text files to the visitor's computer but i need to write the text
    file to the webhost the applet is hosted. its like a log file or a guest book. I know there is a
    way and it can be done but i can't figure it out! Any help would be appreciated! Thanks!
    kvarnerexpress Topic title and description are VERY import to this forum. Edit to fit the quest....
  12. How To Store The Text Typed In A Form?
    sort of newsletter subsciption form (5)
    i would like to add a form on my site, that let's you fill in your e-mail address in order to
    subscribe to a newsletter. Actually, i just need to see their addresses somewhere (in a textfile,
    database, forward to my e-mailaddress,..). How can this be done? I mean, which script do i have to
    use? There is a database available. Php is enabled. I have no acces to cgi-bin, if that's
    needed. I hope someone can help me with this. The alternative would be that there is a link on my
    site so that they can mail it to me, but prefer a script /smile.gif' border='0' styl....
  13. Image Clocks
    (2)
    Does anyone know how to make you r own image clock (like a skin) for your website. The time displays
    like your system. you might take a look a this to know what i mean. So-You.net click here to see
    what i mean ...image clocks ....
  14. Onclick & Ie
    The not so new standards problem (1)
    I want to do some action when I click on a paragraph (for example). Here is the code: CODE ...
    function refresh_data(){ alert ('test'); } Refresh ... This works perfect on
    Firefox and on IE 6.0 and greater. The fact is, it doesn't work on IE 5.0. What should I do?
    Re-design everything to allow all kind of browsers (including those not so old and much used like
    IE5.0) or recommend users to upgrade their borwsers?. On an Intranet service I can limit the design
    to some browsers but when it is a commercial and public application, I can't be ....
  15. Image Show With Thumbnail And Fade
    Does anyone know were I can get this code? (2)
    Hi I would like to know if anyone knows a javascript that makes an thumbnail 'slideshow'
    and when mouseover...it fades...and when you click...it enlarges!!! I saw it somewhere here on the
    net but i cant finf it anymore!!! Can anyone help me...or does anyone know a good javascript
    site???? THANKS ....
  16. Resize Image Before Uploading
    (0)
    Hi, My upload and resizing scripts are working perfectly. Problem is clients are uploading large
    files and the script times out or connection timeout. Problem is with the bandwith and the slow
    connection in South Africa. I have increased the script timeout but it simply takes too long to
    upload. Clients forget that most didgital cameras files are massive and if they simple resize
    before uploading it will save them a huge amount of time. The final file is only 280 X 210 pixels.
    Uploading a 5Mb file over a 56k connection takes a month of Sundays. I have detailed instr....
  17. Rollover Background-image Button Ie
    Rollover background-image button IE (0)
    I find This Code On Search I Think for webmasters is good To Find Easy this Kind of code so i Type
    it here I Hope U enjoy it /blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' />
    Step 1: Insert the below into the section of your page. Change the image path within ".initial"
    to reference the image you want applied initially to the button. .initial{ font-weight:bold;
    background-image:url(first.jpg); } CODE //Specify optional button target: "_new" for new
    window, or name of FRAME target (ie "myframe") var buttontarget="" if (docume....
  18. Where Do I Put The Text?
    (0)
    I actually downloaded this menu applet from Magic Rainbow Buttons I made my own image to use for
    the eye HERE My question is how do I insert text? and where exactly?? here's the source:
    HERE'S The text edit I use: // Create a menu.txt file using the index
    editor "text:" "1" "" "" "" "text:" "1" "" "" "" "text:" "1" "" "" "" "text:" "1" "" "" "" "text:"
    "1" "" "" "" "text:" "1" "" "" "" "text:" "1" "" "" "" "text:" "1" "" "" "" "text:" "1" "" "" ""
    "text:" "1" "" "" ""....
  19. Reading From A Text File
    (8)
    Reading from a text file whats up guys, got some more questions. we are starting to learn how to
    write and read strings to/from txt files. wel thats pretty easy, but how would i retrieve only the
    first 2 lines of the txt file, for example, if i wanted the first 2 lines, not any other, how would
    i do it: 12 90 12 6 -9 how would i go baout doin this. thnks ke....
  20. Image Scroller?
    (6)
    does anybody know where i can find a image scroller script? scrolling up and down?....
  21. Glowing text on mouseover...
    java scripting .. (4)
    One more script for today ... /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0"
    alt="biggrin.gif" /> The text glows on mouseover of the page which will draw the eyes of your
    visitor. Good to use on important lines of text that you want noticed. The colors can be changed
    easily to blend in with your background color, as can be the font style and size. Installation:
    STEP 1: Copy the code below and paste this into the of your html document. Comments have been
    inserted where you change the text size, type and colors at the top part of the scr....

    1. Looking for onclick, image, add, text, input, text, field

Searching Video's for onclick, image, add, text, input, text, field
See Also,
advertisement


Onclick Image ->> Add Text To Input(text)field?

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com