Created
November 7, 2014 09:56
-
-
Save ZiTAL/6bd7136f8d8b5e2171e5 to your computer and use it in GitHub Desktop.
pangramak egiteko programatxoa :D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Pangramak</title> | |
<style type="text/css"> | |
textarea | |
{ | |
width: 90%; | |
min-height: 200px; | |
} | |
div | |
{ | |
display: inline-block; | |
padding: 10px; | |
} | |
.topatuta | |
{ | |
color: #fff; | |
background-color: #800080; | |
} | |
</style> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script type="text/javascript" src="pangrama.js"></script> | |
</head> | |
<body> | |
<h1>Pangrama: </h1> | |
<textarea> | |
</textarea> | |
<br /> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var letrak = | |
[ | |
'a','b','c','d','e','f','g','h','i', | |
'j','k','l','m','n','ñ','Ñ', 'o','p','q', | |
'r','s','t','u','v','w','x','z' | |
]; | |
for(i in letrak) | |
{ | |
var div = $('<div></div>'); | |
div.attr('id', letrak[i]); | |
div.append(letrak[i]); | |
$('body').append(div); | |
} | |
window.setInterval(function() | |
{ | |
$('div').removeClass('topatuta'); | |
var t_val = $('textarea').val(); | |
var m = t_val.match(/[^\s]/gi); | |
if(m!=null && m.length>0) | |
{ | |
for(i in m) | |
{ | |
var tmp = $("div[id="+m[i]+"]"); | |
if(tmp.length>0) | |
tmp.addClass('topatuta'); | |
} | |
} | |
}, 500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment