<!DOCTYPE html>
<!--
/*************************************************************
* This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com
* Feel free to distribute and modify code, but keep reference to its creator
*
* Initial Avatar class creates avatars for users from user initials.
* It creates a hash from the user's name and generates a background color based on it.
* Then it gets a complimentary color for the text, and calculates text size and position
* based on the font and length of initials.
* This package can output binary image data, or apply image to existing img element
* or create new img element
*
* For more information, examples and online documentation visit:
* http://webcodingeasy.com/JS-classes/Create-avatar-from-user-initials
**************************************************************/
-->
<html>
<head>
</head>
<body>
<p>Enter your name: <input type='text' id='name' onkeyup='createAvatar(this)'/></p>
<p><img id='avatar' src=''/></p>
<script type='text/javascript' src='initialAvatar.js'></script>
<script type='text/javascript'>
function createAvatar(ob){
var av = new initialAvatar(ob.value);
av.applyToImage("avatar");
}
</script>
</body>
</html>
|