HTML PHP JavaScript 的关系

1.Whatis HTML?

When you write a normal document using a word processor likeMicrosoft Word/Office, your text is saved in a file with a specialformat. It is not simply saved as the string of words you typedsince the document needs to preserve things like the font youchose, the size of the text, which words are in bold, whichitalics, and so on. The special format includes not only yourwords, but all these extra information so that the next time Wordopens your document, it can display the document with the exactappearance you created earlier.

你浏览的网页是一个有着某种特定格式的页面,而记录这个页面如何显示就是HTML。

In the same way, web pages are simply strings of words put in aspecial format that web browsers are able to display. While theformat of Word documents is simply called "Word format" (or "docformat"), loosely speaking, one might say that web pages areformatted using "HTML". Take the paragraph of text in the box belowfor example:

This is an example paragraph to illustrate what HTML is, for thepurpose of explainingcommon terms like HTML, JavaScript and PHP.

If you were to peek into the raw code for the above words, youwill see the following:

This is an example paragraph to illustrate what HTML is, for thepurpose of <ahref="http://www.thesitewizard.com/html-tutorial/what-is-html.shtml">explainingcommon terms like HTML, JavaScript and PHP</a>.

Notice that it is more or less like the text given earlier,except that there is additional information embedded. For example,the portion that says <ahref="http://www.thesitewizard.com/html-tutorial/what-is-html.shtml"> (whichI placed in a different font above to make it easier to spot) tellsthe web browser that what follows,until </a> isreached, is to be regarded as a link pointing at the web addresshttp://www.thesitewizard.com/html-tutorial/what-is-html.shtml

When the web browser sees this information, it makes the words"explaining common terms like... [etc]" appear as the blueunderlined text that represents a clickable link. The rest of thetext is just displayed as-is.


2. Whatare JavaScript and PHP

Since the HTML/CSS combination isanalogous to the data found in a Word document, it is good only for displayinginformation.

If you want your web pages to do different things depending onthe situation, you will need a programming language. For example,some websites want to provide a membership facility where people can log into thesite, and access certain information. Other sites providea feedback form so that visitors cancontact them. All these things require facilities that a simpledocument format cannot do.

Programswritten in JavaScript run in the web browser itself, so ifyour website has a JavaScript program, the program will beautomatically fetched by your visitor's browser and executed onhis/her computer. 

JS是一种语言,运行在客户端(浏览器就是客户端),可以用来显示网页中的某些功能。浏览器根据用户的请求去服务端,如果服务端有一个js的程序, 这段程序就会被返回给用户。然后你的浏览器把这段程序表示出来。

PHP and Perl programs, on the other hand, runon the computer where your website is located, that is, onyour web host 'scomputer. After the PHP or Perl program does what it needs to do,it sends the result to the visitor's web browser, which merelydisplays the results.

PHP是在服务器上运动的程序语言,用户发来请求,服务器通过PHP程序处理,然后把结果返回给客户端,然后客户端显示出来给用户看。

JavaScriptPHP and Perl are three of the mostcommonly-used programming languages on the Internet. They are usedby websites to carry out more complicated operations.


总结一下,PHP是服务端语言,JS是客户端语言。HTML是一种格式。服务端语言主要是用来生成html+javascript这样的客户端页面的,它们不会被实际发送到客户端,而是先在服务器端的计算机上执行,然后生成客户端代码,再将这些代码发送给浏览网页的客户端。浏览器完全不懂服务器端的语言。


http://blog.sina.com.cn/s/blog_5e8782250100vspz.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值