高分请教有关marquee 开始进到页面的时候,显示从库里读出的前10条数据(静态),当我点击一个按钮(“

你可以设置

  1<marquee> 的ID属性。 例如:   
  2<marquee id="m">   
  3  
  4这样在Javascript里面可以直接用m来控制marquee.   
  5  
  6然后marquee有start和stop的方法,可以控制走与停   
  7  
  8即:   
  9m.Start() // 走   
 10m.stop() //停   
 11  
 12\---------------------------------------------------------------   
 13  
 14<html>
 15<head>
 16<title></title>
 17<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR"/>
 18</head>
 19<body>
 20<table border="0" cellpadding="0" cellspacing="0" width="90%">
 21<tr>
 22<td>
 23<script language="JavaScript">   
 24var statues=1;   
 25function movenow()   
 26{   
 27if (statues)   
 28{   
 29document.all.marquee2.stop();   
 30document.all.btn1.value="动";   
 31statues=0;   
 32}   
 33else   
 34{   
 35document.all.marquee2.start();   
 36document.all.btn1.value="停";   
 37statues=1;   
 38}   
 39}   
 40  
 41</script>
 42<marquee behavior="scroll" direction="up" height="120" id="marquee2" name="marquee2" scrollamount="1" scrolldelay="80" width="370">   
 43我想做下面的效果: 开始进到页面的时候,显示从库里读出的前10条数据(静态),当我点击一个按钮(“动”),然后,原来的那个位置上面的就动态显示数据库里所有的数据(动态),再点击另一个按钮(“静”),就又停止动态,显示前10条!   
 44我想,开始的时候,我就全部读出所有的数据,然后显示的时候,就定表格的高度,那样可以只显示前10条,但是,我怎么能用按钮去控制它动起来,好像marquee没有这样的属性啊,而且,marquee不是一个对象吧(因为没有name属性),我也就没有办法去控制,而且,就算我能控制,我要再重新显示前10条的时候,那应该怎么去控制??   
 45大侠,请帮忙帮忙,谢谢了! bow!   
 46</marquee>
 47</td>
 48</tr>
 49</table>
 50<br/>
 51<br/>
 52<br/>
 53<input id="btn1" name="Submit" onclick="javascript:movenow();" type="button" value="停"/>
 54</body>
 55</html>   
 56  
 57  
 58  
 59  
 60\---------------------------------------------------------------   
 61  
 62  
 63Contents Index Topic Contents   
 64  
 65Previous Topic: MAP   
 66Next Topic: MENU   
 67  
 68  
 69MARQUEE   
 70  
 71\--------------------------------------------------------------------------------   
 72  
 73Description   
 74  
 75Enables you to create a scrolling text marquee.   
 76  
 77Syntax   
 78<marquee behavior="ALTERNATE" bgcolor="color" class="classname" datafld="colname" dataformatas="HTML" datasrc="#ID" direction="DOWN" event="script" height="n" hspace="n" id="value" jscript="" lang="language" language="JAVASCRIPT" left="" loop="n" right="" scroll="" scrollamount="n" scrolldelay="milliseconds" slide="" style="css1-properties" text="" title="text" truespeed="" up="" vbs="" vbscript="" vspace="n" width="n" ¦="">   
 79  
 80  
 81  
 82Parameter Description   
 83BEHAVIOR=ALTERNATE ¦ SCROLL ¦ SLIDE How the text scrolls in the marquee. Alternate The marquee text alternates left and right.   
 84Scroll The marquee text scrolls in the direction specified in the DIRECTION= attribute. The text scrolls off the end and starts over.   
 85Slide The marquee text scrolls in the direction specified in the DIRECTION= attribute and stops when it reaches the end.   
 86  
 87BGCOLOR=color Background color behind the element. For a complete list of colors, see the Internet Explorer color table.   
 88CLASS=classname Class of the tag being defined. This is used to associate a subclassed style sheet with the tag.   
 89DATAFLD=colname Column name from the data source object that supplies the bound data.   
 90DATAFORMATAS=HTML ¦ TEXT Indicates whether bound data is plain text or HTML.   
 91DATASRC=#ID ID of the data source object that supplies the data that is bound to this element.   
 92DIRECTION=DOWN ¦ LEFT ¦ RIGHT ¦ UP Which direction the text should scroll.   
 93HEIGHT=n HEIGHT of the MARQUEE in pixels or as a percentage of the screen height.   
 94HSPACE=n Along with VSPACE, specifies margins for the element.   
 95ID=value SGML identifier used as the target for hypertext links or for naming particular elements in associated style sheets. Valid ID values must begin with a letter. The underscore character, "_", may be used in the ID name. The ID should be unique throughout the scope of the document. If more than one object with the same identifier exists in a document, a collection of those named items is created that can only be referenced by ordinal position.   
 96LANG=language Specifies which language to use in ISO standard language abbreviation form.   
 97LANGUAGE=JAVASCRIPT ¦ JSCRIPT ¦ VBS ¦ VBSCRIPT Specifies the language the current script is written in and invokes the proper scripting engine. The default value is JAVASCRIPT. JAVASCRIPT, JSCRIPT The script is written in JScript.   
 98VBS, VBSCRIPT The script is written in VBScript.   
 99  
100LOOP=n Number of times the marquee text will loop.   
101SCROLLAMOUNT=n Number of pixels the text scrolls between each subsequent drawing of the MARQUEE.   
102SCROLLDELAY=milliseconds Speed the MARQUEE scrolls in milliseconds.   
103STYLE=css1-properties Inline style sheet for the tag.   
104TITLE=text Used to provide advisory information. The contents of the title attribute will be displayed in a tooltip during the onmouseover event.   
105TRUESPEED When present, this attribute indicates that the exact scroll delay value specified is used to move the marquee text. Without this attribute, all scroll delay values of 59 or less are rounded to 60 milliseconds.   
106VSPACE=n Along with HSPACE, specifies margins for the element in pixels.   
107WIDTH=n Returns the calculated width of the marquee in window coordinates. In HTML, this attribute may be initially set in pixels or percentages.   
108event Can be one or more of these events: onafterupdate onblur   
109onbounce onclick   
110ondblclick ondragstart   
111onfinish onfocus   
112onhelp onkeydown   
113onkeypress onkeyup   
114onmousedown onmousemove   
115onmouseout onmouseover   
116onmouseup onresize   
117onrowenter onrowexit   
118onselectstart onstart   
119  
120  
121Remarks   
122  
123Both the start and end tags are required.   
124  
125Example   
126  
127<marquee behavior="SCROLL" direction="RIGHT" scrollamount="10" scrolldelay="200">   
128This is a scrolling marquee.   
129</marquee>   
130  
131Scripting Object   
132  
133MARQUEE   
134  
135  
136  
137\--------------------------------------------------------------------------------   
138  
139Top of Page   
140© 1997 Microsoft Corporation. All rights reserved. Terms of Use.</marquee></marquee></marquee>
Published At
Categories with Web编程
comments powered by Disqus