Using AJAX to implement a script that loads a DIV layer under a click event _ajax related

Source: Internet
Author: User

I want to do a similar function of QQ space comment
I don't know if you've found no  qq. The editor will not be loaded until the text box is clicked.
is not the kind of   that hides   clicks before it is displayed;

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http:// "> <ptml xmlns=" "> <pead> <meta http-equiv=" Content-type "Content=" Tex t/html; charset=gb2312 "/> <title> Untitled document </title> <script type=" text/javascript ">//the function can get The content of right page when user click the "link in the" left side var xmlHttp; var Searching=false; var mydivname= ""; function Getxmlhttp () {A = new ActiveXObject ("Microsoft.XMLHTTP"); return A; } function ExecuteQuery (divname,url) {searching = true; Mydivname = Divname; if (xmlHttp && xmlhttp.readystate!= 0) {xmlhttp.abort (); } xmlhttp=getxmlhttp (); var tempurl= ""; if (xmlHttp && mydivname!= "") {Tempurl + + URL + ". htm" + "?";/ /loading type Tempurl + + & + new Date (). GetTime (); ("GeT ", Tempurl, True); Xmlhttp.onreadystatechange = getreturnhtml; Xmlhttp.send (NULL); }else{searching = false; Mydivname = ""; Window.alert (' The system is too busy, please try again later! '); return false; }} function getreturnhtml () {if (xmlhttp.readystate==1) {document.getElementById (mydivname). Inn erhtml = ""; else if (xmlhttp.readystate = = 4 && xmlhttp.responsetext && searching) {//ale RT (Mydivname); document.getElementById (mydivname). InnerHTML = Xmlhttp.responsetext; alert (Xmlhttp.responsetext); searching = false; } else{document.getElementById (mydivname). InnerHTML = "Access Denied"; } </script> <style type= "Text/css" > <!--#Layer1 {position:absolute; left:8px; top:53px; width:675px; Height:auto; Z-index:1; border:1px solid #000; Overflow:auto; } --> </style> </pead> <body> <div id= "Layer1" ></div> <label> <inpu T type= "button" Name= "Submit" value= "in the following load news" onclick= "executequery (' Layer1 ', ' ')"/> </ Label> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Related Article

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: 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.