PDA

View Full Version : Let JavaScript change text into Image


Stoffel
02-14-2003, 11:48 PM
Hiya,

I was just wondering,

Can JavaScript change text into images (like these smilies :) )
Or does it need a serverside language?

whammy
02-15-2003, 01:35 AM
It depends... where are you getting the text from, and how are you processing it?

Stoffel
02-15-2003, 11:44 AM
I read the CGI script I want to use again, and I found out it wouldn't work because the entries of the guestbook I wanted to make are called with this tag <ENTRIES>. So there wouldn't be any text it could change into an image.

Mhtml
02-15-2003, 10:31 PM
Although I'm pretty much a begginer with javascript I know that it can be done. I have never seen it before but I'm sure I can do it.

I'll be back!

brothercake
02-16-2003, 04:50 AM
Here's a quick, hacky example:

<div onclick="changeMe(this)">Here is some text</div>

then

function changeMe(divObj){
divObj.innerHTML='<img src="an_image.gif" width="150" height="25" alt="Here is an image" title="" />';
}

Stoffel
02-17-2003, 10:34 AM
I need to pick out certain letters (like : ) )
So I guess I can't use your code to do that