灵魂腐蚀 发表于 2015-1-16 23:18:44

ASP网站制作之VBScript - The Easy Stuff - Page 2

使用cdonts,可以发送、查看邮件,实现webmail的功能。结合wsh,可以实现对nt主机的管理,如nt用户管理、iis虚拟主机设置、exchange邮箱设置等等,就像管理本地机一样方便。vbscript

VBScript-TheEasyStuff-Page2

ChrisAssenza

February5,2001


Variables
Ithinkeveryoneknowswhatavariableis,buttobesafe,avariableisalittlechunkofmemoryinwhichavalueofvaryingtype(likecharactersandnumbers)canbestoredandmanipulated.Thatisnotthemostpreciseortechnicaldefinitionthatcouldbeused,butIsuspecteveryonegetsthepicture.Variablesarewhatyouusetostorethedifferentvaluesfloatingaroundinyourprogram.AsIhintedatratherblatantlyabove,variablescantakeonmanydifferentforms.Theycanbestrings(astringisoneormorecharacters―likeasentenceforexample),integer,floatingpointnumber,adate,andallsortsofotherusefulthings.

Oneadvantagetoascriptinglanguageisthatitisnotstronglytyped.Or,inotherwords,touseavariableitdoesnotneedtobedeclaredwithatypedefined.Whereasinastrongly-typedlanguagelikeC++,youneedtodeclarenotonlythevariablebutwhattypeofvariableitis.

InVBScriptthereisreallyonlyonetype,Variant.Therefore,allVBScriptvariablesareoftypeVariant(whichmeanstheycanbasicallybeanything)andmaybeanyofthefollowingsub-types:

SUBTYPEDESCRIPTION
EmptyVariantisuninitialized.Valueis0fornumericvariablesorazero-lengthstring("")forstringvariables.
NullVariantintentionallycontainsnovaliddata.
BooleanContainseitherTrueorFalse.
ByteContainsintegerintherange0to255.
IntegerContainsintegerintherange-32,768to32,767.
Currency-922,337,203,685,477.5808to922,337,203,685,477.5807.
LongContainsintegerintherange-2,147,483,648to2,147,483,647.
SingleContainsasingle-precision,floating-pointnumberintherange-3.402823E38to-1.401298E-45fornegativevalues;1.401298E-45to3.402823E38forpositivevalues.
DoubleContainsadouble-precision,floating-pointnumberintherange-1.79769313486232E308to-4.94065645841247E-324fornegativevalues;4.94065645841247E-324to1.79769313486232E308forpositivevalues.
Date(Time)ContainsanumberthatrepresentsadatebetweenJanuary1,100toDecember31,9999.
StringContainsavariable-lengthstringthatcanbeuptoapproximately2billioncharactersinlength.
ObjectContainsanobject.
ErrorContainsanerrornumber.
Source:MicrosoftScriptingTechnologies

TheneatthingabouttheVariantthingisthatyoudonotreallyneedtoworryabouttypeatall.Itwillfigureoutwhatsub-typethevariableis,basedonhowyouuseit.Whatisimportanttorecognizeisthatifyouutilizeavariableasonesub-type(sayasaninteger)andthentrytostoreastringinitlater,thatwillreturnanerrorbecauseofamismatch.

Touseavariableincode,itfirsthastobedeclared―ormemoryspacehastobesetasideforit.VBScriptusesthe"Dim"statementtodeclarevariables(thereareothersbutwedonotneedtoworryaboutthoserightnow).HereisanexampleofusingtheDimstatement.


<%
Thislittlesingleapostropheisacomment,
itallowsyoutoputexplanationinyour
codeandnothavetheinterpreterrunit!

Usethisasnotestoyourselfforwhatcode
doesornotesforfuturedevelopersworking
onyourpage!

UsingtheDimStatement

DimmyVariable
DimanotherVariable,X,Y,count
%>

Theabovecodeisverysimplistic.ThefirstDimstatementsetsupavariablecalledmyVariable.ThesecondlinedeclaresanotherVariable,XandYallatbasicallythesametime.Itistheretosimplydemonstratethatyoucandeclaremorethenonevariableperline,aslongasyouseparateeachvariablewithacomma.

Nowbeforeyougetallexcitedandstartdeclaringvariablesuntilyourheartiscontent,youshouldknowthatthereareafewrestrictionsfornamingvariables.Theymustbeginwithanalphabeticcharacter(i.e.theycannotstartwithanumber),theycannotcontainanembeddedperiod(ie.nomy.Variabletypenamingisacceptable),theycannotexceed255characters,andtheymustbeuniquelynamed(i.e.cannothavetwodifferentvariablesnamedjiminthesamefunctionorsub).

</p>问题是他们究竟是喜欢他们是使用软件时,速度快还是速度慢好.(当然在3秒以内).无论是他们输入资料时,查找资料时,分析资料时.

灵魂腐蚀 发表于 2015-1-29 06:25:01

Request:从字面上讲就是“请求”,因此这个是处理客户端提交的东东的,例如Resuest.Form,Request.QueryString,或者干脆Request("变量名")

若相依 发表于 2015-2-5 23:13:31

我想问如何掌握学习节奏(先学什么再学什么)最好详细点?

飘灵儿 发表于 2015-2-14 04:07:23

我可以结合自己的经验大致给你说一说,希望对你有所帮助,少走些弯路。

再现理想 发表于 2015-3-4 04:31:38

运用经典的例子。并且自己可以用他来实现一些简单的系统。如果可以对他进行进一步的修改,找出你觉得可以提高性能的地方,加上自己的设计,那就更上一个层次了,也就会真正地感到有所收获。

admin 发表于 2015-3-11 16:39:57

完全不知道到底自己学的是什么。最后,除了教程里面说的几个例子,还是什么都不会。

海妖 发表于 2015-3-19 02:16:58

运用经典的例子。并且自己可以用他来实现一些简单的系统。如果可以对他进行进一步的修改,找出你觉得可以提高性能的地方,加上自己的设计,那就更上一个层次了,也就会真正地感到有所收获。

不帅 发表于 2015-3-27 04:10:50

交流是必要的,不管是生活还是学习我们都要试着去交流,通过交流我们可以学到很多我们自己本身所没有的知识,可以分享别人的经验甚至经历。
页: [1]
查看完整版本: ASP网站制作之VBScript - The Easy Stuff - Page 2