How to color HTML elements based on parsing a user command string
Posted
by Anonymous the Great
on Stack Overflow
See other posts from Stack Overflow
or by Anonymous the Great
Published on 2010-06-11T03:07:20Z
Indexed on
2010/06/11
3:32 UTC
Read the original article
Hit count: 233
I'm working on a little parsing thing to color objects. For an example, you could type red:Hi!: and "Hi!" would be red.
This is my not working code:
<script type="text/javascript">
function post()
{
var preview = document.getElementById("preview");
var submit = document.getElementById("post");
var text = submit.value;
<?php str_replace("red:*:",'<i class="red">*</i>',text); ?>
preview.value = text;
}
</script>
© Stack Overflow or respective owner