It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Not Over-writing Characters

Not Over-writing Characters

Postby MLR on Thu Aug 28, 2008 10:07 pm

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, MLR

<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[i].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>
MLR
 
Posts: 6
Joined: Thu Aug 28, 2008 9:56 pm

Postby rangana on Fri Aug 29, 2008 2:08 am

First, language is a deprecated attribute, type will suffice.

Secondly, add highlighted:
document.getElementById("idMLR").innerHTML+=afterReplaceMLR;

See if it helps.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Postby MLR on Fri Aug 29, 2008 2:22 am

Hi rangana: Thank-You for your response. Unfortunately your code does not work for me. Also I'm not sure why your script addresses color when my topic is about Characters NOT being over-written. Thanx again, MLR
MLR
 
Posts: 6
Joined: Thu Aug 28, 2008 9:56 pm

Postby rangana on Fri Aug 29, 2008 2:28 am

What browser are you using? I should also note to you that your script in the first place is'nt working well on IE.

I did'nt made any changes (except for the suggestion to add plus sign), since you did'nt state about the problem I've noticed and probably you too.

And also, what color do you mean? I did'nt address any color, I just said to add highlighted. Highlighted is colored in red. Hope tha makes sense.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Not Over-writing Characters (now RESOLVED by rangana)

Postby MLR on Fri Aug 29, 2008 3:53 am

Hi Rangana: I apologize if this is a duplicate post. I immediately responded to the second JavaScript POST you sent to me but after one hour, my last POST seems to be missing. Your original suggestion DOES work for me. You did correctly interpret my question. I realized (later) when I pasted in your solution it also included the HTML that made your + Character RED. That is what created the COLOR topic confusion (sorry). I'm new to this JavaScript Forum so I'll be aware that this may happen. Also I'm using FireFox and Safari on a Mac (10X.5 - Leopard). I'll check for Internet Explorer errors later. Thank-You for your help, MLR
below is how the FORUM originally displayed the + Character you sent ...
document.getElementById("idMLR").innerHTML+=afterReplaceMLR;
MLR
 
Posts: 6
Joined: Thu Aug 28, 2008 9:56 pm

Postby rangana on Fri Aug 29, 2008 4:20 am

Glad it made sense. I thought you took it wrongly, but glad it worked ;)

Anyway, I made it a point to highlighted the plus sign so that it'll be visible at your end.

The board's parsing of BBCODE is erroneous, but you should'nt worry on this. I believe webmaster is doing some fix for this right now.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 4 guests