how to add a text to image in javascript

Posted by Shanky11 under JavaScript on 6/7/2013 | Points: 10 | Views : 4032 | Status : [Member] | Replies : 8
i have created a website in that i wants to add text to image to show address just beside the image
or
how to add a label and show text in it in javascript only
how can i add the text to it tell me
------------
function PreloadImages()
{
var img1 = new Image();
img1.src = "images/mall1.jpg";
document.$Image1 = img1;



var img2 = new Image();
img2.src = "images/mall2.jpg";
document.$Image2 = img2;


var img3 = new Image();
img3.src = "images/mall3.jpg";
document.$Image3 = img3;


}

function SetImage(n) {
var image = document.getElementById("myimg");

if (n == 1)
{
image.src = document.$Image1.src;

}
if (n == 2)
{
image.src = document.$Image2.src;
}
else if (n == 3)
{
image.src = document.$Image3.src;

}
}




Responses

Posted by: aswinialuri-19361 on: 6/7/2013 [Member] Starter | Points: 25

Up
0
Down
hi,
refer this link
http://stackoverflow.com/questions/9275965/add-text-on-image-using-position

Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 6/7/2013 [Member] Starter | Points: 25

Up
0
Down
there is nothing inside this link

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: aswinialuri-19361 on: 6/7/2013 [Member] Starter | Points: 25

Up
0
Down
hi,
Not possible directly. However you can set that image as background of <Div> or <P> tag and then add text to those elements.

Instead, it might be better to give the textarea a background. Just use CSS
textarea
{
background: url("image/you/want.jpg");
}
Mark as answer if it helps you
Thank& Regards
Aswini Aluri


Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 6/7/2013 [Member] Starter | Points: 25

Up
0
Down
ok there is a label in my div beside image
how can i assign some text to it in javascript only

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 6/7/2013 [Member] Starter | Points: 25

Up
0
Down
i have created a website in that i am showing images in it on every a change click
now i want whenever i click on the the particular image address related to that image should also come
image is changing but the pblm is how to show text and change it dynamically
please help 4 the sm

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Arronlee on: 10/22/2013 [Member] Starter | Points: 25

Up
0
Down
You mean add annotation to images? I have only tried to am annotation using C#(http://www.yiigo.com/guides/csharp/how-to-annotate.shtml), but not javascript. Thanks for your nice info, I will try it later.

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mattyclown on: 2/19/2014 [Member] Starter | Points: 25

Up
0
Down
You can add text to image by using image annotating function.


Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Thackeray on: 5/28/2014 [Member] Starter | Points: 25

Up
0
Down
Check out this web image annotation add-on, which shows the sample javascript cods on creating text annotation on web image.

http://www.rasteredge.com/how-to/vb-net-imaging/annotate-online/

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response