I'm trying to make a layout in which the titles of articles (and possibly articles themselves, although they're written in an editor that breaks lines so I can't as yet include the article variable within a script... if somebody knows a way around that, it'd be fantastic, but I'd settle for the simpler title option) are written in a custom font. The only way I can think of doing this is including a piece of JavaScript that replaces all characters with small GIFs I will preload. The problem is that I don't seem to be able to find a way to replace more than one character of a certain type (e.g. all "p"s, "t"s, "?"s or whatever) in the same string or document.
At the moment I am using the simple string method of:
- <script type="text/javascript">
-
var first="The quick sly fox jumped over the lazy brown dog."
-
document.write(first.replace(/o/gi, "<img src=myimage.GIF>"))
-
</script>
I'm at a loss as to how to adapt this script to replace more than one type of character with more than one type of image. More than likely I need to scrap this one and start from scratch, but I'm not really good enough with JavaScript to write my own.
Help would be much appreciated!
Thanks,
Hannah