已阅读5页,还剩36页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Web开发基础VBScript ASPprogramming 赵刚 Outline VBScriptASPADO essentialofwebdevelopment 2 WhatisVBScript VBScriptisoneof Script language Script languageislight weightprogramminglanguageVBScriptlight weightversionofVisualBasicVBScriptinHTMLdocument runwhendocumentisloadedor Trigger byevent essentialofwebdevelopment 3 WheretouseVBScriptinHTMLdocument document write HellofromVBScript essentialofwebdevelopment 4 headVbScriptfunctioninHTMLhead Makesurefunctionsisloadedbeforeitiscalled bodyApieceofVBScriptcode runwhenthepageisloaded essentialofwebdevelopment 5 somestatementssomestatements essentialofwebdevelopment 6 Variables dimnamename somevalueorname somevalueoptionexplicitdimnamename somevalue essentialofwebdevelopment 7 essentialofwebdevelopment 8 VBScriptOperators Math essentialofwebdevelopment 9 VBScriptOperators Comparison essentialofwebdevelopment 10 VBScriptOperators Logic essentialofwebdevelopment 11 VBScriptStringConcatenationOperator essentialofwebdevelopment 12 Sub function Submysub argument1 argument2 somestatementsEndSub CallMyProc argument Functionmyfunction argument1 argument2 somestatementsmyfunction somevalueEndFunction name findname essentialofwebdevelopment 13 ConditionalStatements ifpayment Cash thenmsgbox Youaregoingtopaycash elseifpayment Visa thenmsgbox Youaregoingtopaywithvisa elseifpayment AmEx thenmsgbox YouaregoingtopaywithAmericanExpress elsemsgbox Unknownmethodofpayment endIf selectcasepaymentcase Cash msgbox Youaregoingtopaycash case Visa msgbox Youaregoingtopaywithvisa case AmEx msgbox YouaregoingtopaywithAmericanExpress caseElsemsgbox Unknownmethodofpayment endselect essentialofwebdevelopment 14 Looping For NextFori 2To10Step2somecodeNext Do Loopi 0dowhilei i i 1loop essentialofwebdevelopment 15 VBScriptMsgBox Button Integer Allowsyoutosetwhichbuttonswillbedisplayedonyourpopup OKbuttonisthedefaultsetting Title String Setsthetitleofthepopupwindow muchliketheHTMLtitletagsetsthetitleofthebrowserwindow FunctionmyPopup OnClick MsgBox Hellothere 1 GreetingPopup EndFunction essentialofwebdevelopment 16 ASP ASPActiveServerPagesASPruninIISASPsameasHTMLASPmayincludetext HTML XML ScriptScriptinASPfilecanrunontheserver sideASPfile asp or asa essentialofwebdevelopment 17 ASPVs HTML HTMLwillsendtobrowserwithoutanychangeASPfilewillsendtoASPenginefirst whichanalysisthefile runtheScriptinthefile thenreturntheresulttothebrowserinHTMLformat essentialofwebdevelopment 18 WhatcanASPdoforU DynamiceditchangeoraddanypageitemDealwiththedataintheformusersubmitAccessfileordatabase andreturntheresulttotheuserImprovepageusabilityImprovesitesecuritybecausetheaspcodecan treadfromthebrowserAgoodaspcodingcanreducethenetworkload essentialofwebdevelopment 19 BasicASPrule ASPfileincludeHTMLtags liketheHTMLfile but ASPincludeserver sidescript whichwithtag server sidescriptrunontheserver essentialofwebdevelopment 20 Helloworld essentialofwebdevelopment 21 VBScript JavaScript 注意 与VBScript不同 JavaScript对大小写敏感 essentialofwebdevelopment 22 LifetimeofVariables functionSessionApplication essentialofwebdevelopment 23 ASPformanduserinput Gethttp www test org simpleform asp fname Bill lname GatesWelcome PostWelcome essentialofwebdevelopment 24 include includeInsertanotheraspfilebeforeaspfileisrun WordsofWisdom Thetimeis wisdom inc Oneshouldneverincrease beyondwhatisnecessary thenumberofentitiesrequiredtoexplainanything time inc essentialofwebdevelopment 25 Response ASPResponseusedasoutputtobrowser您可以使用HTML标签来格式化文本 这段文本的样式是通过style属性添加的 essentialofwebdevelopment 26 ASPRequest 请选择您喜欢的汽车 value Volvo Volvovalue Saab Saabvalue BMW BMW thenResponse Write 您喜欢的汽车是 cars endif essentialofwebdevelopment 27 您正在通过这款浏览器访问我们的站点 您的IP地址是 IP地址的DNS查询是 调用该页面所用的方法是 essentialofwebdevelopment 28 Server ASPServerAccessserverobjectmethodandproperty 本文件的最后修改时间是 essentialofwebdevelopment 29 ADO ADO ADOfromMicrosoftADOmeansActiveXDataObjectsADOinstalledIISADOistheinterfacetoaccessthedataindatabase AccessdatabasefromASPpageCreateADOconnectionOpentheconnectionCreateADOrecordsetOpentherecordsetGetthedatafromrecordsetCloserecordsetCloseconnection essentialofwebdevelopment 30 ADOconnection DSN lessconnection ODBCconnection essentialofwebdevelopment 31 ADORecordset essentialofwebdevelopment 32 Getdatafromtherecordset essentialofwebdevelopment 33 nextResponse Write rs MoveNextlooprs closeconn close essentialofwebdevelopment 34 x name next looprs close essentialofwebdevelopment 35 ChooseCountry response write rs fields Country rs MoveNextlooprs Closesetrs Nothing thensql SELECTCompanyname Contactname CountryFROMCustomersWHEREcountry country setrs Server CreateObject ADODB Recordset rs Opensql conn CompanynameContactnameCountry response write rs fields companyname response write rs fields contactname response write rs fields country response write rs MoveNextlooprs closeconn Closesetrs Nothingsetconn Nothing essentialofwebdevelopment 36 ADO insertdata CustomerID CompanyName ContactName Address City PostalCode Country 0thenResponse Write Noupdatepermissions elseResponse Write recaffected recordadded endifconn close essentialofwebdevelopment 37 Lab4serversideprogramming PurposeThepurposeofthislabistopracticeASPserversideprogrammingbasedonLab3Exercice1 recorduser scoreinthedatabaseYouaregivenanaccessdatabasenamedscore mdbTable scorewithfields name s scoreSettingtheDSNforthisdatabaseonyourserverRenameandmodifythetestformtorecordthetester snameandhis herscoreinthedatabasewhentesterpushthesubmitbutton essentialofwebdevelopment 38 Exercice2displayallthescoreAddingcodetodisplayallthescore
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 乡镇水厂项目可行性研究报告
- 2027届辽宁省营口市大石桥市金桥中学中考物理最后冲刺模拟试卷含解析
- 广东省佛山市南海区重点中学2027届中考物理猜题卷含解析
- 广东省茂名市高州2027届中考物理全真模拟试题含解析
- 智能温室建设项目技术方案
- 塑料污染治培训讲义
- 主题公园建设项目交通影响评价
- 中小学家校协同育人工作方案
- 无锡市崇安区2027届初中物理毕业考试模拟冲刺卷含解析
- 2027届广西桂林市达标名校中考物理五模试卷含解析
- 2026广东河源市龙川县恩波药械有限公司招聘8人考试备考试题及答案解析
- 2026年党支部书记党务工作培训练习题及答案
- 2026年中石化笔试题库(含答案)
- 高中美术必修《中国书法和中国画的密切关系》教学设计
- 2026秋沪科版(五四学制)八年级物理上册全册每课知识点清单
- 2026中银数字服务(南宁)有限公司招聘笔试模拟试题及答案详解
- RoHS 3.0 指令 2024-1020-EU 中文版(完整译文 + 新旧对比 + 2027 年实施时间表)
- 交管12123学法减分题库500题(含标准答案+解析2026全国)
- 高中入团积极分子考试题库
- 思想政治教育方法论考题
- 免疫规划知识普及课件
评论
0/150
提交评论