HTML反向跟随鼠标的动态元素(动态背景)

设计JavaScript对css的控制和JavaScript事件。
JavaScript

window.onload = () => {
let N = 0.3;
let div = document.getElementById("myDiv");
let img = document.getElementById("img1");
div.addEventListener("mouseenter", (enter) => {
    let XI = enter.clientX
    div.addEventListener("mousemove", (event) => {
        let X = event.clientX;
        if (X > XI) {
            let K = (X - XI) * N;
            img.style.left = -${K}px;
        }else if ( X < XI) {
            let F = (XI - X) * N;
            img.style.left = ${F}px;
        }
    });
    div.addEventListener("mouseleave", () => {
        img.style.left = "0px";
    });
});}

使用Golang编写的基于TCP协议的客户端与服务端通信

使用Golang编写的基于TCP协议的客户端与服务端通信
使用了net,bufio,fmt,os,strings包
Server

package main

import (
    "fmt"
    "net"
)

func main() {
    fmt.Println("Starting the server ...")
    listener, err := net.Listen("tcp", "localhost:5000")
    if err != nil {
        fmt.Println("Error listening", err.Error())
        return
    }
    for {
        conn, err := listener.Accept()
        if err != nil {
            fmt.Println("Errpr accepting", err.Error())
            return
        }
        go doServerStuff(conn)
    }
}
func doServerStuff(conn net.Conn) {
    for {
        buf := make([]byte, 512)
        len, err := conn.Read(buf)
        if err != nil {
            fmt.Println("Error reading", err.Error())
            return
        }
        fmt.Printf("Received data: %v", string(buf[:len]))
    }
}

召唤看板娘