File: example.html

Recommend this page to a friend!
  Classes of Arturs Sosins   JavaScript Initial Avatar Creator   example.html   Download  
File: example.html
Role: Example script
Content type: text/plain
Description: Example for users to try
Class: JavaScript Initial Avatar Creator
Render an avatar image with the user initials
Author: By
Last change:
Date: 10 years ago
Size: 1,263 bytes
 

Contents

Class file image Download
<!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>