|
|
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) ) | |||
![]() |
|
|
thanks in advance!
dang it, i can't believe i forgot that script...
it's something like:
OnMouseClick then document.write something....
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!
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.
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.
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
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
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
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
Hi...
I need code to display an image when mouse is clicked on the web page using java script
-question by eshwari
Similar Topics:
Wordpress Question Adding Static T...
How Do I Disable Text Input Control...
how to get a text feild data from a...
Auto Refresh (4)
|
(0) Apache J2se New Project
|
Loading...
HOME 





Dreamweaver Tutorial - Create a basic Webpage Insert Content
Halo: Reach Multiplayer ViDoc Zugzwang Evolved Extended
Xcode iPhone SDK Tutorial - Assigning Image to a UIImageView
2010 FIFA World Cup Penalty Kick Tutorial HD Extended

