Without Ajax and IFRAME, say the true meaning of Asp+js No refresh technology _javascript skills

Source: Internet
Author: User
What's circulating on the internet <<ajax vs asp traditional No refresh >> ASP without refreshing, add an iframe, get a JS can not be called No refresh ...
The code is not case sensitive, please modify it yourself!
Full static no refreshing idea:
<HTML>
<script src= "" ></script>//countless new calls to the current page global
<SCRIPT>//A series of JS calls
FUNCTION XX (Fun_name,parameter_name,parameter_value)//Parameter Set yourself
{
Docment. Scripts[0]. Src= ' AJAX. ASP? ' +parameter_name+ ' = ' +parameter_value;//parameter and so on
}
</SCRIPT>
<BODY>
The example invokes a, direct call to ASP
My database has <script src= "get_count. Asp?id=xxx "></SCRIPT> Bar
The example calls two, and the event calls Ajax.asp
My database has <label id= "Count" ></LABEL> bar <input type= "button" onclick= "Javascript:xx (COUNT, ' ID ', DOCUMENT. All.id. VALUE); " >
</BODY>
</HTML>
Ajax.asp code in Example two
<%
SET RS = CONN. EXECUTE (SQL_STR)
RESPONSE. WRITE "DOCUMENT. getElementById (' COUNT '). VALUE = ' "&rs (" COUNT ") &" ' "
%>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////
The following omitted part of the HTML code, only to explain the idea
Example three form onsubmit event invocation ajax.asp
<script src= "" ></script>//is a must.
<SCRIPT>
function CHECK ()
{
Alert (' 1 ');
document.getElementById ("")
DOCUMENT.SCRIPTS[0].SRC = "AJAX". Asp?a= "+escape (document.getElementById (' T1 '). value);//This gives the first SCRIPT.SRC assignment
Alert (DOCUMENT.SCRIPTS[0].SRC)//See if the test address is correct
return false;
}
</SCRIPT>
<form method= "POST" action= "onsubmit=" return CHECK (); " Name= "FORM1" >
<input type= "TEXT" name= "T1" id= "T1" >
<input type= "Submit" value= "Submit" >
</FORM>
Example three ajax.asp code
<%
RESPONSE. WRITE "alert ('" &request ("a") & ""); or write Response.Write "document.getElementById (' id '). innerhtml= ' Some HTML code ';"
%>
//////////////////////////////////////////////////////////////////////////////////////////////////
Advantages:
The advantage of this kind of no Refresh method versus Ajax technology is that this method needs to write less code, more concise, faster development, do not write too large and complex JS judgment, the same use of JS, but did not use the DOM XML, the same cross-platform advantages, to achieve the same AJAX user experience effect, And Ajax can be used at the same time, the implementation of different functions code writing patterns and processes, almost the same, more easily improve the code reusability, in fact, only 2 files can be created to achieve a variety of different functions of the site
Disadvantages:
Because this technology relies entirely on JS to assign values to URLs or cookies, and then pass the URL and cookies, the URL and cookie parameters are limited in size and length, so it is not possible to send a large amount of information like Ajax, unless it is done in Ajax or directly with Ajax. But I'm sure we'll find a better solution.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.