Tip: (4) couplets in Asp.net move with the scroll bar

Source: Internet
Author: User
1 < Script Language = " Javascript " >
2 Function close_float_left (){
3 Adlayer1.style. Visibility = " Hidden " ;
4 }
5 Function close_float_right (){
6 Adlayer2.style. Visibility = " Hidden " ;
7 }
8 </ Script >
9 < Script Language = " Javascript " >
10 <! --
11 // More JavaScript from Http://www.smallrain.net
12 Function initecad (){
13 Document. All. adlayer1.style. postop = 130 ;
14 Document. All. adlayer1.style. Visibility =   ' Visible '
15 Document. All. adlayer2.style. postop = 130 ;
16 Document. All. adlayer2.style. Visibility =   ' Visible '
17 Moveleftlayer ( ' Adlayer1 ' );
18 Moverightlayer ( ' Adlayer2 ' );
19 }
20 Function moveleftlayer (layername ){
21 VaR x =   5 ;
22 Var y =   130 ;
23 VaR diff = (Document. Body. scrolltop + Y - Document. All. adlayer1.style. postop) * . 40 ;
24 Var y = Document. Body. scrolltop + Y - Diff;
25 Eval ( " Document. All. "   + Layername +   " . Style. postop = parseint (y) " );
26 Eval ( " Document. All. "   + Layername +   " . Style. posleft = x " );
27 SetTimeout ( " Moveleftlayer ('adlayer1 '); " , 20 );
28 }
29 Function moverightlayer (layername ){
30 VaR x =   5 ;
31 Var y =   130 ;
32 VaR diff = (Document. Body. scrolltop + Y - Document. All. adlayer2.style. postop) * . 40 ;
33 Var y = Document. Body. scrolltop + Y - Diff;
34 Eval ( " Document. All. "   + Layername +   " . Style. postop = y " );
35 Eval ( " Document. All. "   + Layername +   " . Style. posright = x " );
36 SetTimeout ( " Moverightlayer ('adlayer2 '); " , 20 );
37 }
38
39 Document. Write ( " <Div id = 'adlayer1' style = 'position: absolute; width: 100px; Height: 300px; Z-index: 1; left: 7px; top: 165px; visibility: visible '> <Table align = 'center' width = '000000' border = 0 cellspacing = 1 cellpadding = 2> <tr> <TD Height = '000000'> "
40 + " <A href = 'ad/gqyl.htm' target = '_ blank'> </A> </TD> </tr> <TD Height = '16'> "
41 + " <Div align = 'center'> <a href = 'javascript: close_float_left (); '> close </a> </div> </TD> </tr> </table> </div> "
42 + " <Div id = 'adlayer2' style = 'position: absolute; width: 100px; Height: 300px; Z-index: 1; Right: 7px; top: 165px; visibility: visible '> <Table align = center width = '000000' border = 0 cellspacing = 1 cellpadding = 2> <tr> <TD Height = '000000'> "
43 + " <A href = 'newspaper/index. aspx 'target = '_ blank'> </a> </TD> </tr> <TD height = '16'> "
44 + " <Div align = 'center'> <a href = 'javascript: close_float_right (); '> close </a> </div> </TD> </tr> </table> </div> " );
45 Initecad ()
46 // -->
47 </ Script >

In this example, adlayer1 is on the left and adlayer2 is on the right. This is actually something that moves the scroll bar and draws the document in a new position.
As for the floating page advertisement, you can use the timeline to get a few key points, just like flash, and then it starts to change on its own.

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.