Posted By


cobra90nj on 09/18/09

Tagged


Statistics


Viewed 212 times
Favorited by 0 user(s)

alfabeto farfalla


/ Published in: JavaScript
Save to your folder(s)

This is an implementation of alphabet butterfly, its consists in adding a consonant "F" before and after every vowel.


Copy this code and paste it in your HTML
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. //coded by cobra90nj
  5. var str = "";
  6.  
  7. function _prompta ()
  8. {
  9. var iouname = prompt("Inserisci nome","");
  10.  
  11. if (iouname != null && iouname != "") {
  12. document.write("Ciao il tuo nome in farfallino è " + _toFarfall(iouname));
  13. }
  14. }
  15.  
  16. function _toFarfall (name)
  17. {
  18. for (var a in name) {
  19.  
  20. if (name[a].match(/[aeiou]/i)) {
  21. str += "f"+name[a]+"f";
  22. } else {
  23. str += name[a];
  24. }
  25. }
  26. return str;
  27. }
  28. </script>
  29. </head>
  30.  
  31. <input type="button" onclick="_prompta()" value="Inserisci" />
  32.  
  33. </body>
  34. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.