客户端和服务器端代码 [英] Client Side and Server Side code

查看:108
本文介绍了客户端和服务器端代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这称为客户端和服务器端代码.能否举个例子.

解决方案

客户端
Client-side脚本启用interaction within a webpage.
处理用户输入所需的代码由浏览器或插件下载和编译.客户端交互的一个示例是过渡(通常在选择导航选项时触发).
客户端脚本语言包括JavaScript.

服务器端
使用服务器端脚本,完成活动涉及sending information to another computer (server) across the internet.
然后,服务器运行一个程序来处理信息并返回结果,通常是一个网页.
搜索引擎使用服务器端处理.发送关键字后,服务器上的程序会将输入的单词或短语与网站内容的索引进行匹配. (要完成与客户端流程相同的搜索,将需要浏览器下载整个搜索引擎程序和索引.)
服务器端脚本语言包括ASP PHP.

客户端交互
  • 对交互的响应可能更加直接(一旦下载了程序代码)
  • 服务是安全的(因为没有从浏览器发送信息)
  • 依赖在用户使用其计算机上使用特定浏览器和/或插件的情况下
  • 受用户计算机处理速度的影响

服务器端交互
  • 复杂的过程通常更有效(因为程序和相关资源不会下载到浏览器)
  • 发送敏感信息时需要考虑安全性
  • 不依赖于具有特定浏览器或插件的用户
  • 受主机服务器处理速度的影响


参考更多:
服务器端文字客户端 [客户端与服务器端渲染 [ ^ ]


客户端:这是服务器根本不处理的代码/例程.代码是用脚本编写的(通常是JavaScript)-指示客户端执行某项操作的纯文本命令.通常用于执行动态效果,例如图像翻转,显示消息框,甚至验证输入到表单中的数据(即,电子邮件地址的格式为电子邮件地址...包含@符号).

服务器端:这是仅在服务器上执行的代码/例程.代码也可以用脚本(通常是vbscript)编写,但是在ASP.Net的情况下,这是经过编译的语言,例如C#/VB.Net.用于处理内容和返回数据.


您调出一个网页,然后出现一个消息框,显示欢迎使用我的网站".这是客户端.它不需要来自服务器的任何请求即可显示该消息框.该代码已在您的计算机/浏览器上运行.但是您请求的页面显示了您所在镇上播放的电影的列表.该列表是通过调用数据库(位于城市电影资料库等处)来填充/检索的,即通过服务器检索您所在城镇的数据.


有关更多信息,请参见下面的链接:
http://en.wikipedia.org/wiki/Client-side_scripting [ http://en.wikipedia.org/wiki/Server-side_scripting [ http://en.wikipedia.org/wiki/World_Wide_Web [ http://en.wikipedia.org/wiki/HTTP [ http://en.wikipedia.org/wiki/ASP.NET [ http://www.asp.net/get-started [ http://en.wikipedia.org/wiki/Server-side [ http://en.wikipedia.org/wiki/Server-side_scripting [http://en.wikipedia.org/wiki/客户端 [ 解决方案

Client-Side
Client-side scripting enables interaction within a webpage.
The code required to process user-input is downloaded and compiled by the browser or plug-in. An example of a client-side interaction is a rollover (typically triggered when choosing a navigation option).
Client-side scripting languages include JavaScript.

Server-Side
With server-side scripting, completing an activity involves sending information to another computer (server) across the internet.
The server then runs a program that process the information and returns the results, typically a webpage.
Search engines use server-side processing. When a keyword is sent, a program on a server matches the word or phrase entered against an index of website content. (To complete the same search as a client-side process would require the browser to download the entire search engine program and index.)
Server-side scripting languages include ASP and PHP.

client-side interaction
  • response to interaction may be more immediate (once the program code has been downloaded)
  • services are secure (as no information is sent from the browser)
  • reliant on the user having using a specific browser and/or plug-in on their computer
  • affected by the processing speed of the user’s computer

server-side interaction
  • complex processes are often more efficient (as the program and the associated resources are not downloaded to the browser)
  • there are security considerations when sending sensitive information
  • does not rely on the user having specific browser or plug-in
  • affected by the processing speed of the host server


Refer more:
Server Side Verses Client Side[^]
Client-Side vs. Server-Side Rendering[^]


Hi,
Client Side: This is code/routines that are not processed at all by the server. Code is written in scripts (javascript usually) - plain text commands that instruct the client to do something. Generally used for performing dynamic effects, such as image rollovers, or displaying message boxes, or even validation of data entered into a form (i.e. email address is in the format of an email address ... contains the @ symbol).

Server Side: This is code/routines executed only on the server. Code can be written in scripts as well (vbscript usually), but in the case of ASP.Net this is the compiled lanuages like C# / VB.Net. Used for processing content and returning data.

i.e.
You call up a webpage and a message box appears saying Welcome to "my site". This is client side. It did not require any request from the server to have that message box appear. That code was run on your computer/browser. But the page you requested displays a list of movies playing in your town. That list was populated/retrieved through a call to the Database (located at the City movie repository...or whatever) i.e. the server to retrieve that data for your town.


For more information refer the links below:
http://en.wikipedia.org/wiki/Client-side_scripting[^]
http://en.wikipedia.org/wiki/Server-side_scripting[^]



--Amit


Answering this question directly would not help you much. It''s much better for you to read about the very basics in wider scope. Start here:

http://en.wikipedia.org/wiki/World_Wide_Web[^],
http://en.wikipedia.org/wiki/HTTP[^],
http://en.wikipedia.org/wiki/ASP.NET[^],
http://www.asp.net/get-started[^].

See also:
http://en.wikipedia.org/wiki/Server-side[^],
http://en.wikipedia.org/wiki/Server-side_scripting[^],
http://en.wikipedia.org/wiki/Client-side[^].

—SA


这篇关于客户端和服务器端代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆