2020-08-30 html password light and dark text switching + css car driving animation + JS change scope chain + soft skills websocket to achieve handshake

2020-08-30 Subject source: http://www.h-camel.com/index.html

[html] Write a password default asterisk, but you can view the password input box

The main thing is to change the type attribute in the input tag and use jquery to implement a relatively low demo:

<button id="btn" onmousedown="changeText()" onmouseup="changePwd()">按钮</button><br />
<form>
    <input id="pass" type="password" name="txt" />
</form>

<script>
    function changeText() {
        $("#pass").attr("type", "text");
    }

    function changePwd() {
        $("#pass").attr("type", "password");
    }
</script>

[css] Use css3 to realize the animation effect of the car driving

Contains source code:

https://www.html5tricks.com/css3-car-running.html

[js] Which operations of js can change the scope chain?

1. eval() is a global function that can calculate a string and execute the js code in it. The accepted parameter must be the original string, otherwise an exception will be reported.

2.with() is used to set the scope of the code in a specific object, and the specified object will be added to the scope chain.

3. The try-catch will create a new variable object containing the declaration of the error object being thrown.

Summary from https://blog.csdn.net/summer199605/article/details/88901310

[Soft skills] How does websocket realize the handshake?

When websocket establishes a connection, it uses the three-way handshake of the http protocol

1. The client sends a data packet with the synchronization flag of SYN to the server

2. After the server receives the data, it sends a data packet with a SYNACK synchronization confirmation flag to the client

3. The client sends a data packet with ACK confirmation to the server

At this point, a complete connection is established and data transmission begins

Guess you like

Origin blog.csdn.net/vampire10086/article/details/108635047