In fact, it is a piece of code, and its function is to play with your machine through your browser. In this way, the mouse can send some welcome words and love words at a click.
Second, how to put the script in the chat room?
& ltScript src= your script storage address > & lt/script & gt;;
Just put this code in the link in your lower right corner.
3. How does your browser know that you put the script?
Because each script transaction is placed in the
4. What did I learn from the script of Hanjiang River?
1, define a variable:
Var a= 1 means: define a variable a and assign it to 1.
2. Why do you want to define variables?
So, how can no one work? In fact, defining variables is to find a few people in advance and leave them to be assigned later.
3. Define an array variable.
var a_name_filter = new Array(.。 . );
In fact, array variables are also equivalent to finding a person, but this person can do several jobs (belonging to the type of capable people).
4. Define the functional function
Function a () {
This is equivalent to various tasks. Predefined variables are generally reflected here. When you write a () in the script, the browser will be restricted (executing the statement in the a function).
Verb (short for verb) Descriptive text of the script.
Everything must have instructions. No, there must be a script, and it's better to write this manual in the code (otherwise you won't understand it yourself in the future, what a pity! )
So how do you write the instructions?
1, the description of a line of code can be placed at the end of this line of code, and//can be placed at the end of the line, and then a text description can be written.
For example:
Var room_name= "Long Lemon Love"; //Chatroom name
2. What should I do if I write too many words in one line?
It should be noted that although the codes are generally English characters, the description text can definitely be compatible with modern Chinese and classical Chinese.
If it is multi-line explanatory text, you can write it like this.
// -
//The 0.9999 version of Lonely Crane Script is only for my love.
//
//Loss is also a kind of certainty.
//
//Even if the time you have is so short;
//
//Being able to pay for someone without regrets is happiness.
// -
It looks good, doesn't it? (^! -)
Of course, there is a more convenient way to write, that is, write/* in the first line of the explanatory text, and then write */in the last line. Examples are as follows:
/*
The 0.9999 version of Lonely Crane Script is only for my love.
Wei, do you know how much I love you?
I want to take you to the sky.
Look how beautiful that star is.
Pick one and give it to you gently. . .
*/
I strongly suggest that you don't write lyrics in the script, because it may lead to mood swings for people who read the script. :-)
Data type of intransitive verbs
Data types include: string, number and Boolean.
Javascript has the function of data type coercion, which is a great good thing for writers (especially those who have drunk and written code). Otherwise, you have to remember many data conversion functions.
Seven, JScript operator
The interpretation of operators will involve a lot of knowledge. Please ask comrades who have not graduated from primary school to read it after they have finished the primary school course by themselves.
Calculate sign bit operation sign
-
Negative value-logical non!
Increment++is less than
Decreasing-greater than >
Multiplication * is less than or equal to
Division/greater than or equal to > =
Addition+equals = =
Addition+is not equal to! =
Subtraction-Logic and&; & amp
be qualified for sth
Example 1:
x= 1+2
=======
Answer: x is assigned to 3.
Example 2:
If (mylove== "Wei") {
Document.write ("correct answer, you are emotional")
} Otherwise {
Document.write ("Wrong answer! You are the kind of person who has nothing to look for.
} ======
Running results:
If the value of the variable mylove is "Wei", the program will execute document.write ("correct answer, you are perceptual").
Otherwise, execute document.write ("Wrong answer! You are the kind of person who has nothing to look for.
Scripting knowledge I have learned (2)
Tonight, let me think of you quietly (a poem with JS sentences)
Tonight, I sit in the corner and miss you quietly.
I want to know what you are doing and whether you are thinking of me.
I. If ... else statement [Conditionally execute a set of statements according to the value of the expression. ]
I miss you. Do you miss me? If I don't miss you, will you still miss me?
Use the statement to control as follows:
If I miss you {do you miss me? } else{ Do you still miss me? }
Usually, a variable is defined as a judgment condition first.
A =‘' I miss you';
If (a==' I miss you') {b=' Do you miss me?' } else {b=' Do you still miss me?' }
Second, do ... while statement [execute a statement block for the first time, and then execute the statement block repeatedly until the conditional expression equals false. ]
Fold 999 paper cranes and I'll go to bed.
Use the statement to control as follows:
I = 1;
do
(Fold a paper crane; )
I = i++;
While (I < 999)
3.switch statement [When the value of the specified expression matches the label, execute one or more corresponding statements. ]
I miss you,
(Assuming that A has been assigned before)
Switch (a)
Keith wants to light an orange light for you:
Quietly waiting for your tired return;
Keith wants to pass you a cup of warm fragrant tea:
Slowly dispel the tiredness on your face;
Keith wants to use my gentle and slender fingers:
Gently smooth the wrinkles around the eyes;
Keith wants to use my gentle and considerate whisper:
Soothe your restless mind. ;
}
Watching you quietly ...
I pray, pray for the peace and eternity of this moment.
Fourth, the for statement [executes the statement block as long as the specified condition is true. ]
(The second statement can also be expressed by a FOR statement. )
Use the statement to control as follows:
for(I = 1; I & lt999; i++) {
(Fold a paper crane; )
}
Verb (abbreviation of verb) while statement [Execute a statement until the specified condition is false. ]
(The second statement can also be expressed by a while statement. )
Fold 999 paper cranes and I'll go to bed.
Use the statement to control as follows:
var I = 1;
While (I & lt999) {
(Fold a paper crane; )
i++;
}
Scripting knowledge I have learned (3)
The first two articles have roughly introduced the basic knowledge of the script, and the basic knowledge has been introduced almost. Some things that are not commonly used can only be summarized in actual combat.
Let's explain it with the script of Hanjiang 322 first.
A cursory look at the script of Hanjiang 322 can be divided into four parts.
Part I: Variable definition part, line 5 16.
Part II: Add new interface elements.
The third part: Reset the style of the original interface elements.
Part IV: System Initialization
= = = = The first part = = =
This part is introduced in "My Understanding of Scripts (I)".
In fact, some variables (including array variables) are defined, and these defined variables will be used in the following chapters.
Example 1:
Var room_name= "Dreams are like words"; //room name
A variable, room_name, is defined and assigned as: A dream is like a language.
Pay attention to the words above:
Var variable name = variable value;
To define a variable, it must be preceded by a var and a ";". At the end of each sentence. Symbol.
The following "//room name" part is descriptive text, which will be automatically ignored when the script is executed.
Example 2:
//Button background image width, file name
Var a_btn_pic = new array
( 17," btn 17.gif ",
18," btn 18.gif ",
19," btn 19.gif ",
35," btn35.gif ",
46、“btn46.gif”,
70," btn70.gif "
);
Define an array of variables, with each value separated by ",".
In fact, it can also be written in the following form:
var a_btn_pic = new Array( 17," btn 17.gif ", 18," btn 18.gif ", 19," btn 19.gif ",35," tn35.gif ",46," btn46.gif ",70," BTN 70 . gif ");
In this way, the size of the script will be reduced, but the readability of the script will become worse.
Example 3:
//—— Pictures—
Var a_picture = new array
("hello", "pic/P01.gif",
Applause, pic/p002.gif,
. .
. )
and
//—— Background color—
Var a_bkcolor = new array
(“FFFFFF”,
“fdd242”,
“f8fead”,
“a0e4a0”,
. .
. )
It's just that the writing format is different In fact, they all define variable arrays.
Well, up to now, you have fully understood the first 5 16 lines of Hanjiang 322 script (line 322 script *** 1956). congratulations
Scripting knowledge I have learned (4)
The first three articles have roughly introduced the basic knowledge of the script, and the basic knowledge has been introduced almost, and some less commonly used ones can only be summarized in actual combat.
Let's explain it with the script of Hanjiang 322 first.
The following contents shall be implemented as of the date of promulgation. In case of conflict with national laws and regulations, please refer to Hanjiang 322.
A cursory look at the script of Hanjiang 322 can be divided into four parts.
Part I: Variable definition part, line 5 16.
Part II: Add new interface elements.
The third part: Reset the style of the original interface elements.
Part IV: System Initialization
= = = = The first part = = =
This part is introduced in "My Understanding of Scripts (I)".
In fact, some variables (including array variables) are defined, and these defined variables will be used in the following chapters.
Example 1:
Var room_name= "Dreams are like words"; //room name
A variable, room_name, is defined and assigned as: A dream is like a language.
Pay attention to the words above:
Var variable name = variable value;
To define a variable, it must be preceded by a var and a ";". At the end of each sentence. Symbol.
The following "//room name" part is descriptive text, which will be automatically ignored when the script is executed.
Example 2:
//Button background image width, file name
Var a_btn_pic = new array
( 17," btn 17.gif ",
18," btn 18.gif ",
19," btn 19.gif ",
35," btn35.gif ",
46、“btn46.gif”,
70," btn70.gif "
);
Define an array of variables, with each value separated by ",".
In fact, it can also be written in the following form:
var a_btn_pic = new Array( 17," btn 17.gif ", 18," btn 18.gif ", 19," btn 19.gif ",35," tn35.gif ",46," btn46.gif ",70," BTN 70 . gif ");
In this way, the size of the script will be reduced, but the readability of the script will become worse.
Example 3:
//—— Pictures—
Var a_picture = new array
("hello", "pic/P01.gif",
Applause, pic/p002.gif,
. .
. )
and
//—— Background color—
Var a_bkcolor = new array
(“FFFFFF”,
“fdd242”,
“f8fead”,
“a0e4a0”,
. .
. )
It's just that the writing format is different In fact, they all define variable arrays.
Well, up to now, you have fully understood the first 5 16 lines of Hanjiang 322 script (line 322 script *** 1956). congratulations
Let me write a little digression below. As an explanatory language, script still has a certain gap with the real program. From my feeling, writing a script is an application, and writing a program is development. No scripts can be written to the system, but programs can. In addition, there is a lot of artistry in writing programs. Just like painting a landscape painting, it creates artistic conception, not the shape of a tree. The purpose of writing these words is to express my thoughts: since the script is only an application, please enjoy it and don't let it bring more commercial purposes.
Scripting Knowledge I have Learned (V) Attachment: Attack Code
Starting from line 5 17, JS statements will be involved. Actually, there is nothing wrong with the sentence. The hardest part is actually in the beginning I learned more than 500 lines, so it is still difficult.
(Some comrades may not be clear about the content of article (3). Starting today will sober you up a little. )
Let's make an analogy first:
1. Think of the script of the Han River as a building (note: it's a building, not a bungalow, and it's cool to live in Bie Ye).
2. This building is divided into four floors (that is, as I said before, the four parts of the 332 script. )
3. Each floor will have multiple rooms (that is, functions of various functions).
4. Each room will have specific work and responsibilities (that is, the function of each sub-function).
The people in each room should be regarded as variables for the time being.
Let's use a 332 script function to explain.
The function add_new_element()// adds a new interface element.
{ 。
.
.
Write_button (","welcome ",409, 60, 35, 20,", "quick welcome", "autosend(a _ welcome)");");
.
.
.
}
The add_new_element of this code is a function (that is, a custom task, the purpose of which is to add a new interface element to the input area of the chat room. )
Starting from "{"and ending at "}"
The content between "{"and "}" is the specific work of the add_new_element function. For example: write_button (...), write_bkcolor_select (...),
Write_select (...) and so on.
And write_button (...) These are some functional functions. The specific function of this function is in the script line1010-10/4.
In functionwrite _ button (name, value, left, top, width, height, color, title, action).
And the line1010-10/4.
Function write _ button (name, value, left, top, width, height, color, title, action)// Add a button to execute a function.
{write_button_style (name, left, top, width, height, color, title, "");
document . write(' onclick = " "+action+" " & gt; )+value+' & lt; /button & gt; ');
}
This code also includes the write_button_style (...) function.
This level is sometimes easy to confuse people, but it is actually like a big job, divided into many small jobs, and each small job will be divided into several small ones.
Same job.
Going home to cook at night, you can't just cook without cooking, can you? So cooking is actually cooking. You can't just cook one dish, can you? (That also can't drink a little wine.
), no matter how low the standard is, you have to have four dishes and one soup, and each dish is another job. According to our government, remind members that drinking too much wine is harmful to their health! ]
So why put so many letters and numbers in brackets after some functions? These letters and numbers are the variables mentioned in the first article, and they act like a certain item.
Let several people do the same task before assigning tasks.
Like write _ button _ style (name, left, top, width, height, color, title, "");
Name, left, top, width, height, color, title, ""are all assigned to write_button_style, and the last one indicates vacancy.
Because each function is defined in advance, it needs five variables, and you have to send four variables. Sorry, you have to write a ""to indicate the lack of a variable.
You have to give an extra bonus when you calculate. No. )
As for the specific browser how to find that code and how to execute it, don't worry about it. The browser will be like a leader checking labor discipline from beginning to end. (Leadership is the most important.
Never mind, just do your job well, and let the leaders take care of anything that goes wrong. )
If you understand the above paragraph, you can have a general understanding of the functional functions in the 332 script. As for the details such as "typeof(parent.r.listhtml)".
""document.inputform.USER ... "Don't worry about it.