![]() |
Beginner help, script to edit text
Hi all,
I am new to this forum, and a novice at javascripting, I wanted to ask if one of you all could help me create a simple script for me. I need a text box where I can paste a copy like this: Uncommon Trophy of Rage +0 Faction: druid Quality: Uncommon Type: trophy Level: 0 Might: 320 -2.00% Attack Debuff 15.00% Horsed Load 12.00% Troop Training Speed 24.00% Troop Training Speed 15.00% Attack A second text box below that then changes the pasted text into this: Uncommon Trophy of Rage +0 Faction: druid Quality: Uncommon Type: trophy Level: 0 Might: 320 / -2.00% Attack Debuff / 15.00% Horsed Load / 12.00% Troop Training Speed / 24.00% Troop Training Speed / 15.00% Attack Basically it should just add those 5 forward slashes before each stat on the "item". I am thinking something like regex, but I have never used that, so please a novice explanation, or if I can even ask for that, create the script for me. Thank you, DD |
Code:
<input type= "text" id = "box1" size = "240" value = "Uncommon Trophy of Rage +0 Faction: druid Quality: Uncommon Type: trophy Level: 0 Might: 320 -2.00% Attack Debuff 15.00% Horsed Load 12.00% Troop Training Speed 24.00% Troop Training Speed 15.00% Attack"; onblur = "addslashes()"> |
Quote:
Quote:
It doesn't work in IE9 or FF16 because you have a very obvious syntax error in your code ;) |
Quote:
You tell me the very obvious syntax error! It is not obvious to me. :cool: |
Quote:
Code:
Attack"; onblur |
Quote:
I have the awful feeling that we are back with bullant and his many doppelgangers. :mad: |
Thank you Philip, worked like a charm, much appreciated, I owe you a cold one hehe.
DD |
Quote:
|
Quote:
While the disconnected double direct quote is questionable netiquette, you DID have a typo in your posted code, whether it quirked out or not. The "good samaritan act" of offering volunteer help relieves any liability stemming from accidents, which are bound to happen. it's not impossible or even unlikely that the code was both tested and got messed up during the posting; i know i sometimes rework whitespace and comments in the reply box and have been known to delete or add a semi-colon erroneously before. i think it's both understandable and forgivable. zingers can be fun, but you're a landmark here, a coder i look up to. imho, you need not resort to ad-hominem backlashes against noobs. |
Quote:
Might I ask you to kindly indicate exactly what the typo was? Stupidly I have been unable to identify it myself. I don't think that Minder (formerly bullant etc.) qualifies for the appellation "noob". A mod intended to ban him (already) but by mistake ticked the wrong box and awarded him an infraction only. Only two more and we will see the end of him (for a while). |
Code:
<input type= "text" id = "box1" size = "240" value = "Uncommon Trophy of Rage +0 Faction: druid Quality: Uncommon Type: trophy Level: 0 Might: 320 -2.00% Attack Debuff 15.00% Horsed Load 12.00% Troop Training Speed 24.00% Troop Training Speed 15.00% Attack"; onblur = "addslashes()">Quote:
if you did it on purpose, well, that's a different problem for another forum. |
The ; is redundant, I accept, and it was indeed a typo. But it does not affect the working of the script, which I tested before posting.
|
| All times are GMT +1. The time now is 03:47 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.