• QQ聊天字体选择



    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>自定义字体形状</title>
        <style>
            html, body {
                margin: 0;
                padding: 0;
            }
            #wrap {
                background: url(12-img/bg.jpg) 0 0 no-repeat;
                 556px;
                height: 535px;
                margin: 10px auto;
                position: relative;
                display: block;
            }
            #showbox {
                position: absolute;
                top: 100px;
                left: 10px;
                height: 270px;
                 385px;
                display: block;
                font-size: 16px;
                overflow: auto;
            }
            textarea {
                border: none;
                position: absolute;
                 385px;
                height: 75px;
                left: 10px;
                top: 415px;
                font-size: 16px;
            }
            select {
                position: absolute;
                top: 385px;
                left: 8px;
            }
            input {
                position: absolute;
                top: 509px;
                left: 323px;
                 80px;
                cursor: pointer;
            }
            #showbox div {
                 20px;
                display: inline-block;
                font-size: 16px;
                margin: 2px 0;
            }
            div img {
                 16px;
                height: 16px;
            }
        </style>
        <script>
            
        </script>
    </head>
    <body>
        <div id="wrap">
            <div id="showbox">
                <!--<div><img src="12-img/balloon.png"><span>哈<span></div>-->
            </div>
            <select name="fontStyle" id="fontStyle">
                <option value="balloon">气球字体</option>
                <option value="love">表白字体</option>
                <option value="knife">砍刀字体</option>
                <option value="jiong">囧人字体</option>
                <option value="shuai">衰人字体</option>
                <option value="default" selected>默认字体</option>
            </select>
            <textarea id="con"></textarea>
            <input type="button" value="发送" id="btn">
        </div>
    </body>
    </html>
    <script src="../public.js"></script>
    <script>
        json = {
                    'balloon': '12-img/balloon.png',
                    'love': '12-img/heart.gif',
                    'knife': '12-img/knife.gif',
                    'jiong': '12-img/jiong.gif',
                    'shuai': '12-img/shuai.gif'
                };
        var box = $id("showbox");
        //点击发送按钮时 判断是否是默认字体
        $id("btn").onclick = function(){
            var val = $id("fontStyle").value;
            var str = $id("con").value;
            if( val == "default" ){
                box.innerHTML += str + "<br>";
            }else{
                //将字符串拆分成数组
                var arr = str.split("");//1,2,3,4,5
                var html = "";//用来拼接div
                for( var i = 0 ; i < arr.length ; i++ ){
                    html += '<div><img src="'+json[val]+'"><span>'+arr[i]+'<span></div>';   
                }
                box.innerHTML += html + "<br>";
            }
            $id("con").value = "";
        }
    </script>
  • 相关阅读:
    判断二叉树是否是完全二叉树
    二叉搜索树的第k个节点
    二叉树的深度
    二叉搜索树与双向链表
    二叉搜索树的后序遍历序列
    poj 2192 (DP)
    poj 1159 (DP LCS)
    poj 1934(LCS)
    《编程之美》读书笔记 -- 1.2中国象棋问题
    poj 1050(DP)
  • 原文地址:https://www.cnblogs.com/tis100204/p/10319275.html
Copyright © 2020-2023  润新知