Loading...


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

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

 
 Discussion by gotcha41 with 11 Replies.
 Last Update: January 29, 2010, 1:09 am ( View Rated (12) )
 
bookmark - Onclick Image ->> Add Text To Input(text)field?  
Quickly Post to Onclick Image ->> Add Text To Input(text)field?  w/o signup Share Info about Onclick Image ->> Add Text To Input(text)field?  using Facebook, Twitter etc. email your friend about Onclick Image ->> Add Text To Input(text)field? Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

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! :( If you need more information, just ask :(










   Thu May 5, 2005    Reply         

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....

   Thu May 5, 2005    Reply         

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!

   Thu May 5, 2005    Reply         


ok, thanks ! You provided the code i was looking for :(

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

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

   Thu May 12, 2005    Reply         

AwesomeOnclick 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

   Wed Nov 26, 2008    Reply         

Editable textareaOnclick 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 Editorhttp://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.

   Tue Dec 16, 2008    Reply         


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 AWebPage 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

 

   Sat May 2, 2009    Reply         

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

   Sun Jun 28, 2009    Reply         

how to add html to change text scriptletOnclick Image ->> Add Text To Input(text)field?Replying to SystemWisdomHi, 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

   Fri Oct 2, 2009    Reply         

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

   Mon Oct 26, 2009    Reply         

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

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

-reply by ugg boots

   Thu Dec 24, 2009    Reply         

Hi...

  I need code to display an image when mouse is clicked on the web page using java script

-question by eshwari

   Fri Jan 29, 2010    Reply         

Quickly Post to Onclick Image ->> Add Text To Input(text)field?  w/o signup Share Info about Onclick Image ->> Add Text To Input(text)field?  using Facebook, Twitter etc. email your friend about Onclick Image ->> Add Text To Input(text)field? Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Wordpress Question Adding Static T...

above the recent blog posts, i want to add fixed text to the top of the main page. how would i go about doing this? is the solution to edit the index.php file or is there another solution? where are the wordpress gurus? ...more

   06-Feb-2010    Reply         

How Do I Disable Text Input Control...

Hey everyone i have to create a number guessing application using the game logic requirements Menu: File: Exit: Exits Application Game: Start new game: Starts a new game Give me the number: Ends the current game giving the user the game number ...more

   17-Mar-2010    Reply         

how to get a text feild data from a...

how to get a text feild data from an html page to actionscriptCode For Save Input Data1.How to save the text field data in to a variable in html page?2.How to get a text feild data from an html page to actionscript -reply by jasmi  ...more

   15-Mar-2010    Reply         

Auto Refresh    Auto Refresh (4) (0) Apache J2se New Project  Apache J2se New Project