Learn Prototype
Prototype Resources
Selected Reading
© 2013 TutorialsPoint.COM
|
Prototype $w() Method
Advertisements
The $w() function splits a string into an Array, treating all whitespace as delimiters.
Syntax:
Return Value:
Example:
<html>
<head>
<title>Prototype examples</title>
<script type="text/javascript"
src="/javascript/prototype.js">
</script>
<script>
function ShowValues()
{
var str = "Apples Bananas Kiwis";
// Convert string into Array
var arr = $w(str);
arr.each(function(value){
alert(value);
});
}
</script>
</head>
<body>
<p>Click "Show Value" button to see the result</p>
<form>
<input type="button" value="Show Value" onclick="ShowValues();"/>
</form>
</body>
</html>
|
To understand it in better way you can Try it yourself.
Advertisements
|
|
|