About page partial refresh routines

zhaozj2021-02-16  54

.NET Zone | ASP Technology | PHP Technology | JSP Technology | Database

Search for

ASP foundation

Database related

Secure encryption

Full Text Search

ASP application

Print-related

Client-related

XML related

System

Regular expression

ASP skills

Component development

Script code

FSO topic

Mail related

Remote script

Performance optimization

74 Network Programming: ASP Technology: Client Related: About Page Local Refresh Routines About Page Local Refresh Routines

March 25,2004 [Batman] at 99-10-26 06:55:06 A concrete example of the CHINAASP JOY ASP RS technology In the previous post, I introduced the basic working principle of RS, obviously if RS Technical Application In a site design, there will be many extraordinary roles (especially the biggest advantage of it, you can call the server's code when you don't refresh the page). It is because of this feature, you can handle the data of the database like a traditional C / S mode program (I think everyone must know how the specific should be achieved, the following will give one Specific example, debugging this broke program almost gives me a tired, huh, huh, huh, huh, huh, huh.) It can be seen from the previous description. To use RS technology, the client and server need to meet the following two conditions: 1. The client only needs to support the Java Applet 2. The server only needs to support the ASP, that is, RS technology is completely independent and browser (of course, the browser needs to meet support Java and JavaScript), you can use it in IE, you can use it in NC This is also a significant feature of distinguishing between RDS technology. Before you can flexibly use RS technology, you will first explain a problem, which is the "asynchronous call" of "asynchronous call" that has been mentioned earlier. It is also because there is an asynchronous call to implement a part of you only refresh and do not refresh the entire page. Due to this feature, you can make the server to implement the legality check of the data in your browsing page (of course this can be a series of complex legitimacy checks, such as data and databases that need to be entered The existing data is compared, this is not the client's JS can be resolved) and then after the server returns the check result, you will make a corresponding action (eg, a dialog box tells the user to enter an error, etc.) The syntax is as follows: RSEXECUTE (ServerURL, FUNCTIONNAME, PARAM_LIST) The first parameter is the complete URL path of the ASP page you want to call. The second parameter is that the name you want to call the function is the input parameter required for this function. If The function you want to call requires two input parameters, that is, this way: RSEXECUTE (ServerURL, F_Arg_2) There are two ways to write when the call is performed, one is a call mode: objresult = RSExecute ( ServerURL, FUNCTIONNAME, F_ARG_2); another is another call mode without returning results: RSEXECUTE (URL, FUNC_NAME, F_ARG_1, F_ARG_2, CALLBACKFUNCTION); This calling method should be particularly concerned, where CallbackFunction is a client. JS function It represents the call on the server, and then call this function immediately and returns the result to this function.

A typical CallbackFunction function should be such a structure: function callbackfunction (objresult) {// Your own processing} The only input parameter Objresult is the return value of the RS call. Let's assume such a situation: users in the browser Enter the user's E-mail address, and then the user leaves the E-mail address input box to enter the next input process, this is the RS that is on the field, it queries this address in the server according to the address entered by the user, You can judge whether this user already exists, and then returns the result to the client, and uses DHTML technology in the client to prompt the user previously entered information in the input box called "ShowResult". function CallbackFunc (objResult) {// prompt the user information window [objResult.context] .value = objResult.return_value;} while RSExecute () calls should be so RSExecute (serverURL, functionname, f_arg_1, CallbackFunc, "ShowResult"); do not say , Don't say it, there is so much above, I think everyone can also see the head, and let the specific code to speak: (Please build a named NW on your server before using the code. The system DSN file, the file uses the example database of Northworld, the Chinese Access97 comes with the example database below, and the default.htm is divided into two, and the RS technology is used in the main.html page. You can notice it. No Submit is used in main.html, so if you don't appear in this page, you must use the "Get Information" to call with this partial page refresh technology through the mouse. After clicking the button, the page will have a small latency (this time, the Java Applet has established and the server connection in the background) and then immediately reply to the normal mouse, you can continue other in this page. Operation. You don't have to wait for the data when you refresh it like a normal page. Info.asp can understand at a glance, is actually a very simple procedure for processing strings. If you are familiar with DHTML technology, you can complete these operations at the client. As for Empdata.asp, the server processing data is processed. Ok, the benefits you can understand yourself.

Special attention, don't change too much code, otherwise it is easy to make mistakes, after all, is using JavaScript programming default.htm file code as follows: RS technology Implement example </ title> </ head> < Frameset ID = fset rows = "70%, 30%"> <frame name = main src = "main.html"> <frame name = info src = "info.asp"> </ frameset> </ html> MAIM. HTML file code is <HTML> <head> <Title> RS technology implementation example </ title> </ head> <body> <script language = "javascript" src = "http: //yourserver/_scriptlibrary/rs.htm > </ script> <script language = "javascript"> Rsenableremotescripting ("http:// Yourserver / _Scriptlibrary); </ script> <h1> Employee information </ h1> <hr> <form name = myform> Please Enter the name you want to query: <br> <input type = text name = "EMPLASTNAME" size = 40> <input type = button name = btnexecute style = "οnclick =" EXECASYNCH (οnclick = " EMPLASTNAME.VALUE) "> </ form> <hr> <script language =" javascript "> var serverURL =" http: // Yourserver "; var PageURL =" /batman/empdata.asp "; function refreshpage (co) { IF (Co.Status! = 0) {Alert ("Exception error N" Message); top.info.location = "? info.asp info =" escape (strText);} function execAsynch (empLastName) {RSExecute (serverURL pageURL, "GetEmpInfoAsArray", empLastName, refreshPage);} </ SCRIPT> </ BODY > </ Html> Info.asp file code <html> <body></p> <p><% Response.write request.servervariables ("transote_user") strText = request.queryString ("info") if strtext = "" "" "" "" "" "" "" " , City, Employment Date, ",")%> <Table Border = 0> <% for i = 0 to 3 Response.write "<TR>" Response.write "<TD> <B>" & Arrlabels (i ) & "</ b> </ td>" response.write "<TD> <i>" & Arrdata (i) & "</ i> </ td>" Next%> </ table> </ body> </ Html> Empdata.asp file <% @ language = VBScript%> <% rsdispatch%> <script runat = server language = javascript> <! - # include virtual = "/ _ scriptlibrary / rs.asp" -> function Description () {this.GetEmpInfoAsArray = DoGetData;} public_description = new Description (); function DoGetData (empName) {sql = "select * from employee WHERE [name] = '" empName "'"; rst = new ActiveXObject ( "AdoDb.recordset"; Rst.CursorLocation = 3; Rst.Open (SQL, "NW"); i = 0; strText = ""; if (Rst.Record Count == 1) {Strtext = Rst.fields ("Employee ID"). Value "-" Rst.fields ("Respect") .Value "" RST.Fields ("last name") .Value "" Rst.fields ("name") .value; strText = "|";</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-18475.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="18475" 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.045</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 = 'kj0JaQLLQL_2F78dpUL_2B2imGv68Kb7tyxv3BjyPvUlazUVI_2BFRL6eOUq3hOBzxuCyg5v36gakj0pwtNpMk'; 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>