Advertisement effect code commonly used in ASP. NET Website development

Source: Internet
Author: User

Use this post to continuously record some collected advertising effects. We hope to provide some support to our friends who need it. I also hope that my friends will post the unrecorded advertisements together. Make this post more perfect and share it with more friends.
1. Screen flip Effect
Screen flip Effect
Copy codeThe Code is as follows:
<Html>
<Head> <Body>
<Div style = "HEIGHT: 85px">
<Script LANGUAGE = 'javascript '>
Document. ns = navigator. appName = "Microsoft Internet Explorer ";
Function showStr (str, textWidth, num)
{
If (! Document. ns)
{
Document. write (str [0] + '<br> ')
}
Else
{
Var wrt = "";
Wrt + = '<table border = 0 cellspacing = 0 cellpadding = 0> ';
Wrt + = '<tr> <td> ';
Wrt + = '<div id = "icefable1' + num + '"> ';
Wrt + = '<table width =' + textWidth + 'border = 0 cellspacing = 0 cellpadding = 0> ';
For (var I in str)
{
Wrt + = '<tr> <td height = 20>' + str [I] + '</td> </tr> ';
} Scroll_num = I;
Wrt + = '</table> ';
Wrt + = '</div> ';
Wrt + = '<div id = "icefable2' + num + '" style = "position: absolute; z-index: 1; visibility: hidden"> </div> ';
Wrt + = '</td> </tr> ';
Wrt + = '</table> ';
Document. write (wrt );
}
}
Function init_srolltext (num) {countnum = 0; eval ('stopscroll '+ num +' = false ;');
Eval ('icefable1 '+ num +'. scrollTop = 0 ;');
Rotatenum = 0;
Eval ('icefable1 '+ num +'. style. width = 0 ;');
Eval ('icefable1 '+ num +'. style. height = marqueesHeight ;');
Eval ('icefable1 '+ num +'. style. overflowX = "visible ";');
Eval ('icefable1' + num + '. style. overflowY = "hidden ";');
Eval ('icefable1 '+ num +'. noWrap = true ;');
Eval ('icefable1' + num + '. onmouseover = new Function ("stopscroll = true ");');
Eval ('icefable1' + num + '. onmouseout = new Function ("stopscroll = false ");');
Eval ('pretop' + num + '= 0 ;');
Eval ('currenttop '+ num +' = 0; '); eval ('stoptime' + num +' = 0 ;');
Eval ('icefable2 '+ num +'. innerHTML = "";');
Eval ('icefable2 '+ num +'. innerHTML + = icefable1 '+ num +'. innerHTML ;');
Eval ('icefable1 '+ num +'. innerHTML = icefable2 '+ num +'. innerHTML + icefable2 '+ num +'. innerHTML ;');
Eval ('setinterval ("scrollUp '+ num +' ()", 40 );');
}
Function scrollUp1 ()
{
If (stopscroll1 = true) return;
CurrentTop1 + = 1;
If (currentTop1 = marqueesHeight + 1)
{
Stoptime1 + = 1;
CurrentTop1-= 1;
If (stoptime1 = scrolllen * marqueesHeight)
{
CurrentTop1 = 0;
Stoptime1 = 0;
}
}
Else
{
PreTop1 = icefable11.scrollTop;
Icefable11.scrollTop + = 1;
If (icefable11.scrollTop = scrolllen * marqueesHeight + 1)
{
PreTop1 = 0;
CurrentTop1 = 0;
Stoptime1 = 0;
Icefable11.scrollTop = 0;
}}}
Var strArray1 = new Array (); strArray1 [0] = '<a href = http://www.dearbook.com.cn/book/SearchBook.aspx?keyword= Computer fashion application series target = _ blank> </a> <a href = http://www.dearbook.com.cn/book/SearchBook.aspx?keyword= Instance description target = _ blank> </a> <a href = http://www.dearbook.com.cn/book/SearchBook.aspx?keyword= Enterprise-level development case study target = _ blank> </a> <a href = http://www.dearbook.com.cn/subject/top50/ Target = _ blank> </a> '; strArray1 [1] =' <a href = http://www.dearbook.com.cn/2005/c++/ Target = _ blank> </a> <a href = http://www.dearbook.com.cn/subject/VBzh/ Target = _ blank> </a> <a href = http://www.dearbook.com.cn/book/SearchBook.aspx?keyword= Developer Q & A & searchtype = 0 & corder = 3 & page = 1 & log = 0 target = _ blank> </a> <a href = http://www.dearbook.com.cn/book/SearchBook.aspx?keyword= Foreign computer science textbook series target = _ blank> </a> <a href = http://www.dearbook.com.cn/SUBJECT/c++/index.htm Target = _ blank> </a> '; var scrolllen = strArray1.length; marqueesHeight = 82; showStr (strArray1, 580,1); init_srolltext (1); </script>
</Div>
</Body>
</Html>

2. Ad Rotation
Show in turn
Copy codeThe Code is as follows:
<Html>
<Head>
<SCRIPT>
Var elady_tp = new Array ();
Var elady_tplink1 = new Array ();
Var elady_tptext = new Array ();
Var adNumvii = 0;
Elady_tp [0] = "http://pic1.e26.cn/mb/5108/yft/images/1.gif"
Elady_tp [1] = "http://pic1.e26.cn/mb/5108/yft/images/3.gif"
Elady_tp [2] = "http://pic1.e26.cn/mb/5108/yft/images/2.gif"
Var elady_cimage = new Array ();
For (I = 1; I <= 5; I ++) {elady_cimage [I] = new Image ();
Elady_cimage [I]. src = elady_tp [I];
}
Function set_coelady1 () {if (document. all)
{Elady_tprotator1.filters.revealTrans.Transition = Math. floor (Math. random () * 23 );
Elady_tprotator1.filters.revealTrans.apply ();}
}
Function play_coelady1 ()
{If (document. all) elady_tprotator1.filters.revealTrans.play ()
} Function next_elady1 () {if (adNumvii <elady_tp.length-1) adNumvii ++;
Else adNumvii = 0;
Set_coelady1 ();
Document. images. elady_tprotator1.src = elady_tp [adNumvii];
Play_coelady1 ();
TheTimer = setTimeout ("next_elady1 ()", 4000 );}
Function linkurl1 () {jumpUrl1 = elady_tplink1 [adNumvii];
JumpTarget1 = '_ blank ';
If (jumpUrl1! = '') {If (jumpTarget1! = '') Window. open (jumpUrl1, jumpTarget1 );
Else location. href = jumpUrl1;
}}
Function listMsg1 ()
{Status = elady_tplink1 [adNumvii];
Document. returnValue = true;
}
</SCRIPT>
</Head>
<Body>
</a>
</Body>
</Html>

3. mobile ads
Mobile Advertisement
Copy codeThe Code is as follows:
<Html>
<Head> <Body>
<Marquee onMouseOver = this. stop () onMouseOut = this. start () scrollamount = 5 behavior = alternate>
<Table cellspacing = 0 cellpadding = 2 width = "100%" border = 0>
<Tbody>
<Tr>
<Td> </td>
<Td> </td>
<Td> </td>
<Td> </td>
<Td> </td>
<Td> </td>
<Td> </td>
<Td> </td>
<Td> </td>
<Td> </td>
<Td> </td>
</Tr>
</Tbody>
</Table>
</Marquee>
</Body>
</Html>

4. Mobile advertising box
Mobile Advertisement
Copy codeThe Code is as follows:
<Div id = "img" style = "LEFT: 27px; visibility = hidden; POSITION: absolute; TOP: 1115px">
<A href = "www.eyou.com" target = "_ blank">

</A>
</Div>
<Script language = "javascript">
<! -- Begin
Var xPos = 20;
Var yPos = document. body. clientHeight;
Var step = 1;
Var delay = 30;
Var height = 0;
Var Hoffset = 0;
Var Woffset = 0;
Var yon = 0;
Var xon = 0;
Var pause = true;
Var interval;
Img. style. top = yPos;
Function changePos (){
Width = document. body. clientWidth;
Height = document. body. clientHeight;
Hoffset = img. offsetHeight;
Woffset = img. offsetWidth;
Img. style. left = xPos + document. body. scrollLeft;
Img. style. top = yPos + document. body. scrollTop;
If (yon ){
YPos = yPos + step;
}
Else {
YPos = yPos-step;
}
If (yPos <0 ){
Yon = 1;
YPos = 0;
}
If (yPos> = (height-Hoffset )){
Yon = 0;
YPos = (height-Hoffset );
}
If (xon ){
XPos = xPos + step;
}
Else {
XPos = xPos-step;
}
If (xPos <0 ){
Xon = 1;
XPos = 0;
}
If (xPos> = (width-Woffset )){
Xon = 0;
XPos = (width-Woffset );
}
}
Function start (){
Img. style. visibility = "visible ";
Interval = setInterval ('changepos () ', delay );
}
Start ();
// End -->
</Script>

5. Left and right bottom ads
Copy codeThe Code is as follows:
<Script type = "text/javascript" language = "javascript">
Var MmyeeAdShow = 3; // 1 is displayed on the left. 2 is displayed on the right. Others are displayed on both sides.
Var MmyeeAdWidth = 300; // ad width
Var MmyeeAdHeight = 200; // ad height
// Float on the left
Var AdLeftContent = "<div> <iframe id = 'iframy' bordercolor = '#000000 'frameborder = '0' hspace = '0' marginheight = '0' marginwidth = '0' scrolling = 'no' src = 'HTTP: // a311300.cnblogs.com 'width = '"+ MmyeeAdWidth +" 'height =' "+ MmyeeAdHeight +" '> </iframe> </div> ";
// Float on the right
Var AdRightContent = "<div> <iframe id = iframyee frameborder = 0 marginwidth = 0 marginheight = 0 bordercolor = '#000000 'hspace = '0' scrolling = no src = 'HTTP: // a311300.cnblogs.com 'width = '"+ MmyeeAdWidth +" 'height =' "+ MmyeeAdHeight +" '> </iframe> </div>"
// Set the box value at the bottom of the floating data page. do not modify the parameters for the sake of appearance.
Var marginTop = 10
// The distance between the floating border
Var marginLeft = 5
Var navUserAgent = navigator. userAgent
Function load ()
{
Judge ();
Move ();
}
Function move (){
Judge ();
SetTimeout ("move ();", 80)
}
Function judge (){
If (navUserAgent. indexOf ("Firefox")> = 0 | navUserAgent. indexOf ("Opera")> = 0 ){
If (MmyeeAdShow! = "2 "){
Document. getElementById ("adLeftFloat"). style. top = (document. body. scrollTop? Document. body. scrollTop: document.doc umentElement. scrollTop) + (document. body. clientHeight> document.doc umentElement. clientHeight )? Document.doc umentElement. clientHeight: document. body. clientHeight)-(MmyeeAdHeight)-marginTop + 'px ';
}
If (MmyeeAdShow! = "1 "){
Document. getElementById ("adRightFloat"). style. top = (document. body. scrollTop? Document. body. scrollTop: document.doc umentElement. scrollTop) + (document. body. clientHeight> document.doc umentElement. clientHeight )? Document.doc umentElement. clientHeight: document. body. clientHeight)-(MmyeeAdHeight)-marginTop + 'px ';
Document. getElementById ("adRightFloat"). style. left = (document. body. clientWidth> document.doc umentElement. clientWidth )? Document. body. clientWidth: document.doc umentElement. clientWidth)-MmyeeAdWidth-marginLeft + 'px ';
}
}
Else {
If (MmyeeAdShow! = "2 "){
Document. getElementById ("adLeftFloat"). style. top = (document. body. scrollTop? Document. body. scrollTop: document.doc umentElement. scrollTop) + (document.doc umentElement. clientHeight = 0 )? Document. body. clientHeight: document.doc umentElement. clientHeight)-(MmyeeAdHeight)-marginTop + 'px ';
}
If (MmyeeAdShow! = "1 "){
Document. getElementById ("adRightFloat"). style. top = (document. body. scrollTop? Document. body. scrollTop: document.doc umentElement. scrollTop) + (document.doc umentElement. clientHeight = 0 )? Document. body. clientHeight: document.doc umentElement. clientHeight)-(MmyeeAdHeight)-marginTop + 'px ';
Document. getElementById ("adRightFloat"). style. left = (document.doc umentElement. clientWidth = 0 )? Document. body. clientWidth: document.doc umentElement. clientWidth)-MmyeeAdWidth-marginLeft + 'px ';
}
}
If (MmyeeAdShow! = "2 "){
Document. getElementById ("adLeftFloat"). style. left = marginLeft + 'px ';
}
}
If (MmyeeAdShow! = "2 "){
Document. write ("<div id = \" adLeftFloat \ "style = \" position: absolute; width: "+ MmyeeAdWidth + "; \ "> <table border = 0 cellpadding = 0 cellspacing = 0> <tr> <td>" + AdLeftContent + "</td> </tr> </table> </ div> ");
}
If (MmyeeAdShow! = "1 "){
Document. write ("<div id = \" adRightFloat \ "style = \" position: absolute; width: "+ MmyeeAdWidth + "; \ "> <table border = 0 cellpadding = 0 cellspacing = 0> <tr> <td>" + AdRightContent + "</td> </tr> </table> </ div> ");
}
Load ();
</Script>

6. Floating advertisement on the left
Copy codeThe Code is as follows:
<Script event = "onload" for = "window" language = "javascript">
Init_Ad_Left (); // after loading the page, call the init_Ad_Left () function ().
</Script>
<Script language = "javascript">
<! --
Function init_Ad_Left (){
Document. all. AdLeftLayer. style. posTop =-200;
// After the onLoad event is triggered, the advertisement layer is opposite to the fixed y-direction position.
Document. all. AdLeftLayer. style. visibility = 'visible '// set the layer to visible
MoveLeftLayer ('adleftlay'); // call the MoveLayer () function ()
}
Function MoveLeftLayer (layerName)
{
Var x = 20; // The floating ad layer is fixed in the x direction of the browser
Var y = 200; // The floating ad layer is fixed in the y direction of the browser.
Var diff = (document.doc umentElement. scrollTop + y-document. all. AdLeftLayer. style. posTop) *. 90;
Var y = document.doc umentElement. scrollTop + y-diff;
Eval ("document. all." + layerName + ". style. posTop = y ");
Eval ("document. all." + layerName + ". style. posright = x"); // Mobile Ad Layer
SetTimeout ("MoveLeftLayer ('adleftlay');", 0); // call the MoveLayer () function after 20 milliseconds ()
}
// -->
</Script>
<Div id = "AdLeftLayer" style = 'position: absolute; width: 100px; height: 200px; z-index: 20; visibility: visible; left: 20px; top: 100px '>
Add the content you want to place
<! -- Embed a subpage -->
<Iframe id = "iframyee11" allowtransparency = 'true' bordercolor = '#000000' frameborder = "0" height = '20' hspace = '0' marginheight = "0" marginwidth = "0" scrolling = "no" src = 'detail. aspx 'width = '000000'> </iframe>
Dsfsfqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
Qqqqq qqqqqqqq qqqqqqqqqq qqqqqqqqq
</Div>

7. Floating advertisement on the right
Copy codeThe Code is as follows:
<Script event = "onload" for = "window" language = "javascript">
Init_Ad_Right (); // after loading the page, call the init_Ad_Right () function ()
</Script>
<Script language = "javascript">
<! --
Function init_Ad_Right ()
{
Document. all. AdRightLayer. style. posTop =-300; // After the onLoad event is triggered, the ad layer is opposite to the fixed y direction position.
Document. all. AdRightLayer. style. visibility = 'visible '; // set the layer to visible.
MoveRightLayer ('seaghtlay'); // call the MoveRightLayer () function ()
}
Function MoveRightLayer (layerName)
{
Var x = 20; // The floating ad layer is fixed in the x direction of the browser
Var y = 200; // The floating ad layer is fixed in the y direction of the browser.
Var diff = (document.doc umentElement. scrollTop + y-document. all. AdRightLayer. style. posTop) *. 90;
Var y = document.doc umentElement. scrollTop + y-diff;
Eval ("document. all." + layerName + ". style. posTop = y ");
Eval ("document. all." + layerName + ". style. posright = x"); // Mobile Ad Layer
SetTimeout ("MoveRightLayer ('seaghtlay');", 0); // call the MoveRightLayer () function after 20 milliseconds ()
}
// -->
</Script>
<Div id = "AdRightLayer" style = 'position: absolute; width: 100px; height: 200px; z-index: 20; visibility: hidden; right: 30px; top: 600px '>
Add the content you want to place
<! -- Embed a subpage -->
<Iframe id = "iframyee2" allowtransparency = 'true' bordercolor = '#000000' frameborder = "0" height = '20' hspace = '0' marginheight = "0" marginwidth = "0" scrolling = "no" src = 'detail. aspx 'width = '000000'> </iframe>
Hhhhhh hhhh hh hhhhhh hhhhhhhh hhhhhh
</Div>

8. Floating advertisements on the left and right
The following layers remain unchanged. The init_Ad_Left () and init_Ad_Right () methods are loaded simultaneously in event = "onload ".
Floating ad
Copy codeThe Code is as follows:
<Script event = "onload" for = "window" language = "javascript">
Init_Ad_Left (); // after loading the page, call the init_Ad_Left () function ()
Init_Ad_Right (); // after loading the page, call the init_Ad_Right () function ()
</Script>

9. falsh ad wheel display
Flash ad Demo
Thank you for providing this advertisement display style.
Interested friends can also encapsulate custom controls in ASP. NET. This is more convenient to use.

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.