Hello: For the final result, I want the whole STRING (ab_cd_efg_h) to appear in the yellow DIV box. How do I prevent the destruction of the current CHARACTER when the new CHARACTER is created ? I use the ALERT box so you can see the creation and destruction of the CHARACTERs in the yellow DIV box. Thank-You, MLR777
<html>
<head>
<title>replace Method</title>
<script language="javascript" type="text/javascript">
window.onload=triggerMLR1;
function triggerMLR1()
{
var inputMLR = "ab*cd*efg*h";
for (var i=0; i<inputMLR.length; i++)
{
afterReplaceMLR=inputMLR.replace("*", "_");
document.getElementById("idMLR").innerHTML=afterReplaceMLR;
alert(afterReplaceMLR);
}
}
</script>
</head>
<body style="font-family : arial; font-weight : bold;">
<hr />
<div id="idMLR" style="width : 300px; height : 10px; background-color : #ffff00; padding-bottom : 10px; padding-right : 3px; padding-left : 3px; padding-top : 2px; border : 1px solid #000000;">
</div>
<hr />
original STRING: ab*cd*efg*h
<br />
desired STRING: ab_cd_efg_h
</body>
</html>
<html>
<head>
<title>replace Method</title>
<script language="javascript" type="text/javascript">
window.onload=triggerMLR1;
function triggerMLR1()
{
var inputMLR = "ab*cd*efg*h";
for (var i=0; i<inputMLR.length; i++)
{
afterReplaceMLR=inputMLR.replace("*", "_");
document.getElementById("idMLR").innerHTML=afterReplaceMLR;
alert(afterReplaceMLR);
}
}
</script>
</head>
<body style="font-family : arial; font-weight : bold;">
<hr />
<div id="idMLR" style="width : 300px; height : 10px; background-color : #ffff00; padding-bottom : 10px; padding-right : 3px; padding-left : 3px; padding-top : 2px; border : 1px solid #000000;">
</div>
<hr />
original STRING: ab*cd*efg*h
<br />
desired STRING: ab_cd_efg_h
</body>
</html>