Advice 1: How to do a script

Literally translated, the word script means the script that is the description of the sequence of actions which need to be made to perform a specific task. In relation to Internet programming such tasks can be, for example, the clock displaying on the web page, the implementation of a variety of visual effects with pictures etc showing in the browser page itself in a modern network is also running on the specified in the script scenario. Let's try to write a few simple scripts to get an idea of what they represent.
How to write scripts
Instruction
1
Depending on where the execution of the script, the scripts are divided into "client" and "server". If some address in the network, we send the URL of pages to the server and that runs the script located at the specified address. The script executing on the server programmed in this operation, collects the page from the right blocks and send it to the browser. It is the server side script. After receiving the page, the browser on our computer renders it for us and if in the resulting page code is a script, then he deals with the execution of this script. This is a client script.
To server or browser to be able to read, understand and execute the script it needs to be made and recorded according to the known rules. Such rule sets are called scripting programming languages. Most server-side scripts are currently written in PHP, and most of the client - in JavaScript. To write a script enough to have a plain text editor – Notepad. But for a permanent programming of scripts to do without a specialized editor. This editor takes the lion's share of routine work on writing scripts, leaving the programmer more time for creativity.
Let's write a simple script on the server PHP. The first line is necessary to inform the contractor that this place begins the script. In PHP this opening tag looks like this:<?RRA closing tag:?>Between these two tags are the user - language operators. For example, an instruction to print a sign, left O. Bender on the Caucasian cliffs, is written like this:echo ("there was kisya and Osya");And the instruction to show the current time in the format HOUR:MINUTE written as:echo date('H:i');All PHP script is composed of these operators will look like this:<?phpecho ("In ");
echo date('H:i');
echo (" there was kisya and Osya!");?>After executing this script, the server program-performer (interpreter) page would look like this:
The result of executing the server script
2
But the same script on the client JavaScript would be:var now = new date();
document.write ("");
document.write (now.getHours() + ":" + now.getMinutes());
document.write (" there was kisya and Osya!");Here, the string var now = new date() gives the contractor the script command to create a new virtual object named "now" which represents the current date and time. document.write () is the command to write in the page that is indicated in parentheses, and the team now.getHours() now.getMinutes() prescribe to fetch from the object “now” the current hour and minute.
Left for greater clarity, to combine these two script into a single file, save it on the server and type in the URL in the browser address bar. The result will see the same rows, one of which was implemented in our scenario on the server (with PHP interpreter) and the other in our computer (the JavaScript interpreter).
The result of executing the client and server scripts

Advice 2: How to make a script

In Internet programming, there is always a need to draw a virtual contractor to perform the needed programmer actions in the browser or on the server. Actions can be, for example, visual effects or processing of the entered visitor data in your browser. Or build the requested page from the individual blocks on the server. Virtual by these actions will be the server software or browser, and the script for the performer will have to write on one of the scripting programming languages. To get a General idea about how to make scripts, let's write a simple script in JavaScript.
How to make a script
Instruction
1
JavaScript runs within your browser, so all that is needed for writing and execution, is already in the computer. As a working tool of the programmer will use a plain text editor - Windows Notepad. This is enough to create a simple script, but, of course, for permanent programming it is better to use a specialized editor.The first step: in Notepad, create a new document to record the instructions to the browser.
2
Now you can start writing code instructions. The browser understands more than one language - for example, for the page markup language is HTML (HyperText Markup Language "hypertext markup language"), and to further describe the appearance of page elements - CSS (Cascading Style Sheets - "cascading style sheets"). To give the executor of the script to understand that this part of the source page is written in JavaScript, all instructions should be placed inside opening and closing tags:<script type="text/javascript">
...
</script>Instructions for the browser are called by the operators of the language. For example, the instruction to read and memorize for use later in the script the current date and time of the computer looks like this:var aTime = new Date();Now the object contains data aTime on the date and time and, if necessary, they can be retrieved and processed. Other manual - printed in the page body or a message looks like this:document.write("any message");note - there is an object named "document", it is not necessary to create, this happens automatically. It is a virtual image of the current page. From this object you can retrieve information about the page and can implement different transformation - for example, in this line of code you write is recorded in the document the text "some message".Now engage in the scenario of both these lines - write on the page current time:document.write ("the Current time" + aTime.getHours() + ":" + aTime.getMinutes());Here a simple operation of addition (+) you held up four constituent parts of the print string. The final your simple script would look like this:<script type="text/javascript">
var aTime = new Date();
document.write ("the Current time" + aTime.getHours() + ":" + aTime.getMinutes());
</script>
3
Final step: save the script with file extension html or htm (for example, timeJS.html). To see what you got, open the file in browser, just click it double click.

Advice 3: How to start sh script

You have written a shellscript, but I don't know how to run it. Faced with this problem many novice Linux users. In order for the script was run, it should be a special way to prepare. This can be done in different ways.
How to start sh script
Instruction
1
The easiest way to do the script's executable and run them using Midnight Commander. In most Linux distributions it is already there. However, it is usually absent in ALT Linux and Ubuntu, in this case you must install it by running the following command:IN ALT Linux to install this program, you will have to download it in the form of a RPM file and then install. Navigate to the folder in which the file resides using the cd command, followed by the full path to this folder. Then run the following command:rpm -i ./filename.rpm
where filename.rpm the downloaded file.In Ubuntu the process of downloading and installing automated, to run it you will have to use just one command:sudo apt-get install msse all these commands are run from root. In Ubuntu there is no such mode, so before apt-get and use the command sudo. After Midnight Commander installed, you can launch any user using the following command:mc
2
If Midnight Commander is not used, change access rights to file with shellscriptom so that it could be executed, with the command:chmod 755 filename
where filename is the name of your file with the scriptof om.Now try to run it:./filename
3
If you prefer to use Midnight Commander change permissions to the scriptat the following. Run this program, navigate to the folder you created the file, hover over the pointer, then in the menu "File" select "permissions". Check the box in Start/search for owner", "Start/search for the group" and "Start/search for the other" (some may not install if you do not wish to allow it to run the script to other users). Save settings click "Install".Now the name of the file in the list will turn green, and on his left you will see the asterisk. Hovering cursor on it and pressing Enter, you will be able to run the file.

Advice 4: What is Java script

Java-script is a programming language that allows you to improve the appearance of web pages and their functionality. To write the script in any text editor and viewed in a browser that is capable of processing scripts.
the people in the office at the computer table
JavaScript is a special prototype-oriented programming language. It can be embedded in the html code of the web pages, thereby increasing the functionality of the site. Squeak allows developers of various browsers to make the page interactive, so this comfortable and functional language every day becomes more and more popular.

Java-script is considered to be one of the easiest programming languages, largely due to its similarity with Java, which determined the first part of its name. The architecture of this software language has a number of features, which is primarily due to its similarity with other languages, and secondly, its application in practice. Not to mention the property of memory, which can be controlled automatically and also dynamic typing in type, prototiposite programming and the presence of features considered as first class objects.

That allows JavaScript



Java script allows you to create beautiful interactive pages that can not be done in pure html language. Typically, the script execution is preceded by any user actions: click, hover, etc. the Implementation of this language, starts when you load a web page. To write Java script by using any text editor. To view the article in the browser can process scripts. We are talking about Netscape Navigator (starting with the 2nd version) and Microsoft Internet Explorer (starting with the 3rd version).

Since both these browsers have spread quite widely, nearly all users are working with this programming language, improving the appearance of web pages and their functionality. By the way, appear in browsers scripts can vary. Most of the javascripts which you can download from the Internet free, Opera support can not.

How to place code in a separate file



You need to create in any text editor page and save it. Continue to download some Java-script code and place it in this page. Save in the same folder .html. Now you need to connect the JavaScript to the html page. To do this in the HTML file, you need to make a record.

Scripts written in the language of this script? can be placed on the html page between the same tags. Tag
Is the advice useful?
Search