ServerSideIncludes:ExperiencedJavaScriptprogrammersknowthatcodereuseisgood.ExperiencedJavaScriptprogrammersalsoknowthatJavaScriptfunctionsaredatatypes.So,weshouldbeabletostoreaJavaScriptfunctioninsideaSessionVariableoranApplicationVariable,right?Unfortunately,no.ThewaytoreuseJavaScriptfunctionsacros...
http://www.jb51.net//article/7441.htm
Overview:TheSessionObjectishowyoutrackasingleuseracrossmanypages.Ithasfour(4)properties,two(2)collections,one(1)method,andtwo(2)events.GetStarted:Inthisseriesofexampleswewillcreateapasswordsystem.WewillusetheSessionObjecttotrackwhetherornotauserisauthorizedtoviewcertainpages.Belowareseveralscriptsfo...
http://www.jb51.net//article/7440.htm
Overview:TheApplicationObjectrepresentsacollectionofASPpages.TheApplicationobjecthaszero(0)properties,two(2)collections,two(2)methods,andtwo(2)events.GetStarted:Belowareacouplescriptsforlesson11.<%@LANGUAGE="JavaScript"%><%//NoASPHere,justaregularHTMLPage%><HTML><FORMACTION="scr...
http://www.jb51.net//article/7439.htm
Global.asa:Firstofall,whatisaglobal.asa?It'sanoptionalscriptfilethatholdscertain"global"informationthatyoucanaccessthroughtheentireASPappliciation.Theglobal.asaisaplaintextfilesavedwiththe.asaextension.Youshouldonlyhaveoneglobal.asaanditshouldgoinyourtopleveldirectory.Belowisanexampleglobal.asafile....
http://www.jb51.net//article/7438.htm
ResponseCookiesinGeneral:We'llstartwiththeResponseCookiescollection.Idon'tthinkitcouldbeanyeasier.Yousimplyputthenameofthecookieintheargument.Thecorrespondingvalueisastring.Theonlytimeitgetscomplicatediswhenyouusekeys(whichIdemonstratebelow).<%@LANGUAGE="JavaScript"%><%varTomorrow=newDate()...
http://www.jb51.net//article/7437.htm
RequestObject:Requesthasfive(5)Collections,one(1)Property,andone(1)Method.You'llusetheCollectionsfarmorethanthepropertyorthemethod.RequestCollections:BelowisatableoftheRequestCollectionsanddescriptionsofhowtheyareused.RequestCollectionsClientCertificateRequest.ClientCertificate("Key[Field]")Clientse...
http://www.jb51.net//article/7436.htm
BelowisatableofResponsePropertiesalongwithexamplesandexplanations.ResponsePropertiesBufferResponse.Buffer=trueAllowsforthebufferingofoutputCacheControlResponse.CacheControl="Public"SetsCacheto"Public"or"Private"CharSetResponse.CharSet="windows-1252"SetstheISOcharactersetContentTypeResponse.ContentTy...
http://www.jb51.net//article/7435.htm
response对象:reponse是asp中六个对象之一。它代表了服务器端对浏览器的回应。response有8种方法,9种属性和一个集。在这一课,我们就重点讲述方法。方法:在javascript中,asp方法使用括号。请注意依赖response.buffer的两个方法,我们将在下一课讲到他们。同样应该注意到addheader()和redirect(),因为他们必须优先于write()执行。所有的方法都在上面描述和演示了。下面我将详细讲述每一个方法。我将花点额外的时间来讲述我们用的最多的两个方法。write()和redirect():下面是第六课的两个asp脚本。下面是script6a.asp...
http://www.jb51.net//article/7434.htm
两条防线,一个函数:试问你如何能保证客户端和服务器端具有相同的功能?表单域的验证闪现在我们眼前。别人把你的html复制到另外一个脚本,然后改变客户端的表单域验证--这并不是一件难事。摆在眼前的解决方法是将表单域的验证放置在服务器端。但那又意味着因为使用者的一个小错误,都要给服务器端要返回一串的错误信息。那么,我们何不同时拥有二者呢?不仅仅如此,我们还可以在客户端和服务器端使用同一个javascript函数来保证二者的完全一致性。看看下面这一小段,请特别注意一下checkMyZip()函数。[code]<%@LANGUAGE="JavaScript"%><%//No ...
http://www.jb51.net//article/7433.htm
开始:你能让javascript和vbscript实现从同一个表格里传出音乐。看看下面的脚本:[html]<%@LANGUAGE="JavaScript"%><SCRIPT LANGUAGE="JavaScript" RUNAT="Server">function JSGreeting() { return "Greetings from a JavaScript Function"; &n...
http://www.jb51.net//article/7432.htm
开始:newString()是本课程计划中较早出现的另一个让人感觉到奇怪的地方。但和转义字符一样,newString()是创建一个成功的aspjavascript应用的必须元素。下面是本课的两个脚本:下面是实际上承担重量的脚本:行为中的newString():现在我们来看看下面的asp行。Request.Form我们将在后面有独立的课程来讲授。下面才是我们现在要讲的重点。在request.form中所持有的数据(来自用户的数据)并不是一个javascript数据类型。相反,它是一个asp本地数据类型。javascript并不能处理asp数据类型。解决的方法就是将asp数据类型转换成javasc...
http://www.jb51.net//article/7431.htm
