3.asp foundation

xiaoxiao2021-03-06  34

This article ASP article (1) shows some of the most basic methods for the ASP dynamic website design. I believe that the ASP has had the most basic understanding of the ASP, and this article will further introduce the ASP dynamic website while answering questions. Some basic techniques.

Since the first article of this article, I have received some friends' comment from some friends. I am very expected that a considerable part is the first time I first contact ASP, so many friends have proposed why browse ASP articles in the browser (1) What is the original code when I see? Since there are more friends who have encountered this problem, the author answers here. First of all, I want to emphasize the ASP to be a server-side script environment. When the user requests the .asp file from the browser, the ASP script starts running, then the web server calls the ASP, ASP fully read the requested file, execute all The script command is sent to the browser, which means that you cannot simply browse .asp files in an existing operating system (such as Win95, 98), use the "Open" command in your browser; , Run .asp files require server-side support, except for Microsoft Internet Information Server in Windows, Active Server can also be used for the components of the Personal Web Server in MS Windows NT Workstation and MS Windows 95/98, so regardless What you install is NT or WIN95 / 98, you must install the ASP server-side environment on the original system to allow your machine to run .asp files. Since most friends are now installed in Win95 or 98, the author focuses on how to run and browse .asp files in Win95 / 98. Because Mspersonal Web Server supports Universal Gateway Interface (CGI) applications, Internet Database interface (IDC) applications, IIS Application Interface (ISAPI) applications, and supports running and developing ASP applications, making Win95 and afterwards It has a sound website operation and management function similar to NT. What you have to do is installed on the existing WIN95 / 98 system, which is recommended to install the latest version 4.0. When the installation is complete, PWS4.0 will be automatically loaded when the system is started. Open the PWS, select the "Advanced" button in the left column (see below asp2a.gif), point the "/ _private" directory under the "virtual directory", then click the "Edit Properties" button on the right, as shown, In the dialog box, you can edit the physical path and directory name of the virtual directory. The physical path of "/ _Private" is "D: / INETPUB / WWWWROOT", which is the system default WWW release root directory, will An example Test1.asp file is copied to the D: D: / INETPUB / WWWROOT directory. Finally, just select the access permission of the virtual directory to "execute" and enter "http://localhost/test1.asp" in the "address" column of the browser, you can run and browse the ASP program.

Know how to run and browse the ASP program, let's continue the study of the ASP dynamic website design.

The previous introduced several of the most basic ASP programs, I believe that everyone has a general understanding of the application of ASP, this article will continue to introduce some web dynamic functions written with ASP. Due to the inconsistency of the web browser standard, how to make our own websites adapted to a variety of different browsers have become the most headache of the website designers. Under the current situation, we are not willing to abandon Netscape or IE, but we sometimes have to consider the actual browsing effect of the client browser. In the past, we often use JavaScript to write a program to identify different browsers used by the client, then today Let's take a look at how to use ASP more convenient and accurately to this purpose. Put the following code, scrapped into your Notebook and saved as Browser.asp. <% @ Language = vbscript%>

Use the browser performance components provided by ASP to identify customer browsers </ title></p> <p></ HEAD></p> <p><Body bgcolor = "white" TopMargin = "10" leftmargin = "10"></p> <p><font size = "4" face = "Arial, Helvetica"></p> <p><b> Use the browser performance components provided by ASP to identify <BR> other customer browser </ b> </ font> <br></p> <p><hr size = "1" color = "# 000000"></p> <p><! - Define and create browser performance objects -></p> <p><%</p> <p>DIM BC</p> <p>Set bc = server.createObject ("mswc.browsertype")</p> <p>%></p> <p><! - Describe the information of the customer browser in the table -></p> <p><Table border = 1></p> <p><tr></p> <p><TD> Browser Name </ TD></p> <p><TD> <% = bc.browser%> </ td></p> <p><tr></p> <p><TD> Browser Version </ TD></p> <p><TD> <% = bc.version%> </ td></p> <p><tr></p> <p><TD> MAJOR VERSION </ TD></p> <p><TD> <% = bc.majorver%> </ td></p> <p><tr></p> <p><TD> Minor Version </ TD></p> <p><TD> <% = bc.minorver%> </ td></p> <p><tr></p> <p><TD> Frame Support </ TD></p> <p><TD> <% = bc.frames%> </ td></p> <p><tr></p> <p><TD> Table Support </ TD></p> <p><TD> <% = bc.tables%> </ td></p> <p><tr></p> <p><TD> Cookie Support </ TD></p> <p><TD> <% = bc.cookies%> </ td> <tr></p> <p><TD> Background Sound Support </ TD></p> <p><TD> <% = bc.backgroundsounds%> </ td></p> <p><tr></p> <p><TD> VBScript Support </ TD></p> <p><TD> <% = bc.vbscript%> </ td></p> <p><tr></p> <p><TD> JavaScript Support </ TD></p> <p><TD> <% = bc.javascript%> </ td></p> <p></ table></p> <p></ Body></p> <p></ Html></p> <p>Use the HTTP mode to browse this file, depending on the browser used, you will see a page similar to the following image (asp2b.gif). In this example we use an ASP ActiveX Components - "Browser Capabilities". The ActiveX component is run as a web-based application section running on the web server. Components provide the main functionality of the application (such as access, modifying the database, etc.) so that the web designers do not have to create or recreate the code to perform these tasks, thus Improve the efficiency of the work, and discuss in detail in the ActiveX components. In order to use ASP to distinguish the customer browser, we create a Browser Type object with the "Browser Capabilities" component, which provides a user script with a client web browser feature, when the browser is connected to the web server, It automatically sends a useERAGENTHTTTTTTTTTTT, which is a declarative browser and its version of the ASCII string. This Browser Type object compares the title and the items in the browscap.ini file (Win98, IIS3, IIS4 can be "WIN98 / System / INERSRV" in the following directory, "/ Winnt / System32 / InetSRV / ASP / CMPNTS "," / Winnt / System32 / InetSRV "found this file). If a matching item is found, the Browser Type object will consider the browser list properties to match the UseRAgent title. If the object does not find items matching with the title in the browscap.ini file, the default browser properties will be used. If the object does not find a match and the default browser settings are not specified in the browscap.ini file, it sets each attribute to a string "unknown". We can update the Browscap.ini file to add an attribute or new browser definition to the component, thereby expanding the browser range and accuracy of the ASP identification. Some of the contents in browscap.ini (not included) is listed below:</p> <p>[IE 4.0] ;; httpuseragentheader</p> <p>Browser = IE ;; Specifies the name of the browser.</p> <p>Version = 4.0 ;; Specify the version number of the browser.</p> <p>Majorver = 4 ;; Specifies the primary version number</p> <p>Minorver = 0 ;; Specify the sub version number</p> <p>Frames = true ;; Specifies whether the browser supports the framework.</p> <p>TABLES = true ;; Specifies whether the browser supports the form.</p> <p>Cookies = true ;; Specifies whether the browser supports cookies.</p> <p>Backgroundsounds = true ;; Specifies whether the browser supports background music. Vbscript = true ;; Specifies whether the browser supports VBScript.</p> <p>JavaScript = true ;; Specifies whether the browser supports JScript.</p> <p>Javaapplets = true ;; Specifies whether the browser supports Java programs.</p> <p>ActiveXControls = true ;; Specifies whether the browser supports the ActiveX control.</p> <p>Win16 = false ;; Specify whether the browser supports Win16</p> <p>Beta = false ;; Specifies whether the browser is beta.</p> <p>CDF = true ;; Specifies whether the browser supports Channel Definition Format for Web prediction.</p> <p>;; IE 4.01</p> <p>[Mozilla / 4.0 (compatible; msie 4.01 *; windows 95)]</p> <p>Parent = IE 4.0 ;; Parent Tag allows the second browser to inherit the definition of the first browser</p> <p>Version = 4.01</p> <p>Minorver = 01</p> <p>Platform = Win98</p> <p>;; Default Browser ;; Specify the setting of the default browser</p> <p>[Default Browser Capability Settings]</p> <p>Browser = default</p> <p>Frames = false</p> <p>Tables = TRUE</p> <p>Cookies = FALSE</p> <p>Backgroundsounds = FALSE</p> <p>VBScript = false</p> <p>JavaScript = false</p> <p>In the above example, the parent label allows the second browser to inherit the definition of the first browser so that Microsoft Internet Explorer4.01 defines all of the properties defined by Microsoft Internet Explorer 4.0 (for example, frames = true, Tables = True and cookies = true). The platform is specified by adding a Platform = Win98 to rewrite the version information with Version = 4.01.</p> <p>In the previous Browser.asp, we just rank out the properties of the customer browser, let us add some dynamic effects. Scrapped the following code to file Browser.asp (Edit Note: For the convenience, all "<" The symbol has added a sluggage, please pay attention to remove it when actually use.):</p> <p><% IF (bc.frames = true) THEN%></p> <p>Your browser supports the framework! <Br></p> <p><% ELSE%></p> <p>Isn't you still using a browser that does not support the frame ??? <br></p> <p><% end if%></p> <p><% IF (bc.tables = true) THEN%></p> <p>Your browser supports the form. <br></p> <p><% ELSE%></p> <p>Do you still use a browser that does not support the form ??? <br></p> <p><% end if%></p> <p><% IF (bc.backgroundsounds = true) THEN%></p> <p>Have you heard a wonderful music ??? <br></p> <p><% ELSE%></p> <p>Unfortunately, your browser does not support back music. <br></p> <p><% end if%></p> <p><% IF (bc.vbscript = true) THEN%></p> <p>Your browser supports VBScript. <br></p> <p><% ELSE%></p> <p>Your browser does not support VBScript. <br></p> <p><% END IF%> <% IF (bc.javascript = true) THEN%></p> <p>Your browser supports JavaScript. <br></p> <p><% ELSE%></p> <p>Your browser does not support JavaScript. <br></p> <p><% end if%></p> <p>Refresh Browser.asp in your browser, the program will automatically identify the properties of the browser and dynamically display different information. It is difficult to find that there is almost no complex programming throughout the Browser.asp file, which is easy to achieve dynamically identifying the customer browser and dynamically generates a response event. In fact, the key to this program is that the ActiveX component mentioned above - "Browser Capabilities", its role is similar to a function, just simply calling the component in the program to achieve what you want.</p> <p>Through the introduction of these two, everyone has seen the preparation ASP program is quite easy. To master the ASP, nothing more than five objects built into the ASP, as well as the object, method, and attributes of the ACTIVEX component provided by the ASP, of course solid The scripting language written ability is also necessary. In the future, the author will focus on these built-in objects and components and methods of use, so stay tuned.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-58019.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="58019" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.038</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '5hmcueLrN_2BwMrhxb_2F8CvnGdHqkKxzeNRRd7vKwDjkMS9NGNLxP0XW7R2_2BSxkkEFYPFPrEt7VEnaEBKd_2B'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>