gotcha41 0 Report post Posted May 5, 2005 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 Share this post Link to post Share on other sites
whyme 0 Report post Posted May 6, 2005 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.comdang it, i can't believe i forgot that script...it's something like:OnMouseClick then document.write something.... Share this post Link to post Share on other sites
SystemWisdom 0 Report post Posted May 6, 2005 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: <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! Share this post Link to post Share on other sites
gotcha41 0 Report post Posted May 12, 2005 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 ! keep up the good work. Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 27, 2008 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 Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 17, 2008 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 Editorhttps://www.tinymce.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. Share this post Link to post Share on other sites
iGuest 3 Report post Posted May 2, 2009 Works great, but how about if the form box was on a linked page?Onclick Image ->> Add Text To Input(text)field?Replying to SystemWisdomHi,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 Share this post Link to post Share on other sites
iGuest 3 Report post Posted June 28, 2009 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 Share this post Link to post Share on other sites
iGuest 3 Report post Posted October 2, 2009 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 Share this post Link to post Share on other sites
iGuest 3 Report post Posted October 26, 2009 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 Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 25, 2009 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 Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 29, 2010 Hi... I need code to display an image when mouse is clicked on the web page using java script-question by eshwari Share this post Link to post Share on other sites