Computing.Net > Forums > Web Development > Javascript HTML

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Javascript HTML

Reply to Message Icon

Name: ahsiwel
Date: June 6, 2009 at 22:29:08 Pacific
OS: Windows XP
Subcategory: Javascript/Ajax
Comment:

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
You

The 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.



Sponsored Link
Ads by Google

Response Number 1
Name: shutat
Date: June 7, 2009 at 03:41:00 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Javascript HTML

Help modify some JavaScript/HTML www.computing.net/answers/webdevel/help-modify-some-javascripthtml/2761.html

Javascripts in ASP www.computing.net/answers/webdevel/javascripts-in-asp/36.html

Building Personal Website www.computing.net/answers/webdevel/building-personal-website/881.html