Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hey.
Sorry, Im completly new to this site, my ffriend just recommended it to me. :)
I only know basic HTML and almost no Javascript.
I really need a javascript script that replaces the text enclosed in the quotation marks ("; ") with "
"
so that is just an enter. EG.
Hello; Nice; To; Meet; You;
into
Hello
Nice
To
Meet
YouThe text needs to be entered into an input feild on a html document and then you hit a button or something and it automatically does this for you. Could someone plese write me a script to do this? Thankyou so much if you do.

<html> <head> <script language="javascript"> function mysplit(val) { var s = val.replace(/;/g, ' ').split(' '); for(var i=0; i < s.length; i++) { var d = document.createElement("div"); d.id = "div" + i; d.innerHTML = s[i]; document.body.appendChild(d); delete(d); } } </script> </head> <body> <input id="inp" value="Hello; Nice; To; Meet; You;" type="text"> <input value="submit" type="button" onclick="mysplit(document.getElementById('inp').value);"> </body> </html>

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |