View Single Post
  #3 (permalink)  
Old June 14th, 2005, 06:48 AM
interrupt interrupt is offline
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Chris, I did it the long way:

<script language ="javascript">
function addsmile(){

var SmileStr = document.form1.smilebox.value
var thestr = ":\)"
var found = 0;
var thehtml = "<img src =\"grin.gif\">"
var thenewstr

    while (found != -1){
    found = SmileStr.indexOf(thestr, found)


        if (found >-1){
        thenewstr = SmileStr.replace(thestr, thehtml)
        alert(found)
        found++
        }
        found-1
        SmileStr = thenewstr

    }

div1.innerHTML = thenewstr
}
</script>

Thanks Anyway

interrupt

Reply With Quote