This article introduces some source code that is often used in ASP programming. Suitable for beginners to read. I hope it will be helpful to you, let’s take a look together!
ASP is the abbreviation of Active Server Page, meaning dynamic server page. ASP is an application developed by Microsoft to replace CGI scripting programs. It can interact with databases and other programs and is a simple and convenient programming tool. The following is a summary of the code that ASP often uses.
1. Obtain system time:
- <%=now()%>
2. Obtain the IP for visiting:
- <%=request.serverVariables(remote_host)%>
3. Obtain the system and browser version:
- <script>
- window.document.write(version: +navigator.appName+navigator.appVersion+browser.)
- </script>
4. Remove the IE hybrid bar:
- <bodyscroll=no>
- or
- <bodystyle=overflow-y:hidden>
5. Enter the website and pop up the ad:
- <scriptlanguage=javascript>
- <!--
- <!--Note to change the path of the file -->
- window.open('http://www.XXXXXX.com','','height=200,width=300,top=0,left=30');
- //-->
- </script>
6. Random number:
- <%randomize%>
- <%=(int(rnd()*n)+1)%>
N is the variable number
7. Scroll up the code:
- <marqueedirection=upscrolldelay=200
- style=font-size:9pt;color:#FF0000;line-height:150%;font-style:italic;font-weight:bold
- scrollamount=2width=206height=207bgcolor=#FFFF00>hhhhhhhhhhhhhhhhhhhhh</marquee>
8. Automatically close the web page:
- <scriptLANGUAGE=javascript>
- <!--
- setTimeout('window.close();',10000);//Close in 60 seconds
- //-->
- </script>
- <palign=center>This page will automatically close after 10 seconds. Please pay attention to refreshing the page</p>
9. Random background music:
- <%randomize%>
- <bgsoundsrc=mids/<%=(int(rnd()*60)+1)%>.midloop=-1>
You can modify numbers and limit the number of calls. Here are 60.
10. Automatically refresh this page:
- <script>
- <!--
- varlimit=0:10
- if(document.images){
- varparselimit=limit.split(:)
- parselimit=parselimit[0]*60+parselimit[1]*1
- }
- functionbeginrefresh(){
- if(!document.images)
- Return
- if(parselimit==1)
- window.location.reload()
- else{
- parselimit-=1
- curmin=Math.floor(parselimit/60)
- cursec=parselimit%60
- if(curmin!=0)
- curtime=curmin+minute+cursec+seconds before re-brushing this page!
- else
- curtime=cursec+reflash this page after seconds!
- window.status=curtime
- setTimeout(beginrefresh(),1000)
- }
- }
- window.onload=beginrefresh
- file://-->
- </script>
This is the first article about the commonly used source code of ASP, and the next article will recommend to you another 12 commonly used source codes that are essential for beginners.