Common ASP code (i)

Source: Internet
Author: User
Tags sql
Get HTML for a page

<script>
var oxmlhttp = new ActiveXObject ("Microsoft.XMLHTTP");
Oxmlhttp.open ("Get", "http://www.163.com", false);
Oxmlhttp.send ()
var ostream = new ActiveXObject ("ADODB. Stream ");
if (ostream = null)
Alert ("Your machine does not support ADODB.stream.")
Else
{
ostream.type=1;
ostream.mode=3;
Ostream.open ();
Ostream.write (Oxmlhttp.responsebody);
ostream.position= 0;
Ostream.type= 2;
Ostream.charset= "gb2312";
var result= ostream.readtext ();
Ostream.close ();
Ostream = null;
var AA = window.open ("", "")
document.write (result);
Aa.document.write (result);
}
</script>

[Open a new window]======================================================================================================= =====
window.open (' filename ', ', ', ' toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, Width=400,height=570,top=200,left=300,bottom=0,right=0 ');

[About JS Call]======================================================================================================= =====
new.asp (call file)
<%

str = "Circular fetch of data to invoke"
' The key is the following sentence, call the document function Print input str value--->
%>
document.write (' <%=str%> ')
OK, end, insert in the other page to be called
<script language= "javascript" src= "New file directory/news.asp></script>

[Opens a window and closes the current window]============================================================================================= ===============
<script language= "JavaScript" >
-->
window.open (' menumain.asp ', ', ', ' toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, Width=,height=,top=0,left=0,bottom=0,right=0 ');
Window.opener = "Meizz"; Add this code ie5.5+ won't have a close prompt
Window.close ();
//--
</script>

[Paging Display Records]======================================================================================================= =====
One.
<%
Dim maxperpage
Dim totalpage
If not IsEmpty (Request ("page") Then
Currentpage=cint (Request ("page")
Else
Currentpage=1
End If
%>

Two.
<%
Set Rs=server.createobject ("Adodb.recordset")
Sql= "Select the ' from person ' ORDER by id DESC"
Rs.Open sql,conn,1,1
If rs.eof and Rs.bof then
Response.Write "No Talent Information"
Else
rs.pagesize=10
Maxperpage=rs.pagesize
Totalpage=rs.pagecount
If Currentpage<1 Then
Currentpage=1
End If
If Currentpage>totalpage Then
Currentpage=totalpage
End If
If Currentpage>1 Then
Rs.move (CurrentPage-1) *maxperpage
Dim bookmark
Bookmark Rs.bookmark
End If
I=1
Do, not rs.eof and i<=10
%>
...... The data displayed on this page
<%
I=i+1
Rs.movenext
Loop
End If
Rs.close
%>

Three.
<a href= "allrencai.asp?page=1> first page </a>
<a href= "allrencai.asp?page=<%=currentpage-1%> previous page </a>
<a href= "allrencai.asp?page=<%=currentpage+1%>" > next page </a>
<a href= "allrencai.asp?page=<%=totalpage%> last page </a>
Just follow the pattern above and you can do it, there should be no problem!

[Get User ip]======================================================================================================= =====
Request.ServerVariables ("REMOTE_ADDR")

[Object Display and Concealment (style.display application)]================================================================================== ==========================
Document.name.style.display= "None"; Hide
document.name.style.display= "Block"; Show

[Change text font size]===================================================================================================== =======
<script language= "JavaScript" >
<!--
function Fontzoom (size)
{
document.getElementById ("Fontzoom"). style.fontsize=size+ "px"
}
-->
</SCRIPT>
<TABLE>
<TR>
&LT;TD id= "Fontzoom" >1234fsdfsdfasd234234311dfasdfsd23</TD>
<td><a href= "Javascript:fontzoom" >12</a></TD>
<td><a href= "Javascri



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