mirror of
https://github.com/TBEDP/datavjs.git
synced 2025-12-08 19:45:52 +00:00
45 lines
1.2 KiB
HTML
45 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Color</title>
|
|
<script src="../../deps/jquery-1.7.1.js"></script>
|
|
<style type="text/css">
|
|
ul, li, div, body {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
ul {
|
|
list-style: none;
|
|
}
|
|
#container {
|
|
width: 980px;
|
|
margin: 0 auto;
|
|
}
|
|
#input textarea {
|
|
width: 800px;
|
|
height: 300px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="container">
|
|
<div id="input">
|
|
<textarea>["#3ac2f0", "#3797ee", "#356cec", "#3340ea", "#4c31e8", "#742fe6", "#9b2de4", "#c22ae2", "#e028d7", "#de26ac", "#dd2480", "#db2255", "#d9202a", "#d73f1f", "#d5661d", "#d38e1b", "#d1b519", "#c1cf17", "#96cd15", "#6bcc14"]
|
|
</textarea>
|
|
<button>看一看</button>
|
|
</div>
|
|
<div id="output"></div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$('button').click(function () {
|
|
var input = eval($('#input textarea').val());
|
|
var output = input.map(function (color) {
|
|
return '<li style="background-color: ' + color + '"> </li>';
|
|
});
|
|
$("#output").html('<ul>' + output.join('') + '</ul>');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|