chrisdude911 wrote:
i have a video in a html document.
i have typed <img dynsrc="My Immortal.mpg"/> in to create a video box.
on http://www.acejs.com/scriptsfolder/110003/110003.html it tell me
about adding controls to a box for songs
how do i connect that to my video box?
also when i minimize the page the music on the video stops. how do i
prevent that from happening?
If you are using the code in the text box on the page for which you
give the URL, you should be aware that it has several validation
errors. I would guess this code is rather out of date as are many codes
on many of the free JS sites. I would not use such a flawed code or try
to update it, but to each their own.The validation report from the W3C
is below. In addition, the script uses the outmoded document.all only
and not modern getElementBy Id. This means that any of the code that
uses document.all will work only on IE browsers and close relatives as
well as perhaps Opera. It will not work of Firefox, Mozilla, Netscape,
and many other recent browsers.
__________________________________________________ _________________________
Result: Failed validation, 13 errors
File: upload://Form Submission
Encoding: utf-8
Doctype: HTML 4.01 Transitional
DOCTYPE Override in effect!
The DOCTYPE Declaration for "HTML 4.01 Transitional" has been
inserted at the start of the document, but even if no errors are shown
below the document will not be Valid until you add the new DOCTYPE
Declaration.
This page is not Valid HTML 4.01 Transitional!
Below are the results of attempting to parse this document with an SGML
parser.
1. Error Line 6, column 22: document type does not allow element
"STYLE" here .
<STYLE type="text/css">
The element named above was found in a context where it is not
allowed. This could mean that you have incorrectly nested elements --
such as a "style" element in the "body" section instead of inside
"head" -- or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in
HTML documents. Due to HTML's rules of implicitly closed elements, this
error can create cascading effects. For instance, using XHTML's
"self-closing" tags for "meta" and "link" in the "head" section of a
HTML document may cause the parser to infer the end of the "head"
section and the beginning of the "body" section (where "link" and
"meta" are not allowed; hence the reported error).
✉
2. Error Line 12, column 38: an attribute value must be a literal
unless it contains only name characters .
<table class=topbox border=0 width=100%>
You have used a character that is not considered a "name
character" in an attribute value. Which characters are considered "name
characters" varies between the different document types, but a good
rule of thumb is that unless the value contains only lower or upper
case letters in the range a-z you must put quotation marks around the
value. In fact, unless you have extreme file size requirements it is a
very very good idea to always put quote marks around your attribute
values. It is never wrong to do so, and very often it is absolutely
necessary.
✉
3. Error Line 15, column 29: required attribute "TYPE" not specified
..
<SCRIPT LANGUAGE="JavaScript">
The attribute given above is required for an element that you've
used, but you have omitted it. For instance, in most HTML and XHTML
document types the "type" attribute is required on the "script" element
and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and
type="text/javascript" for <script>.
✉
4. Error Line 78, column 111: required attribute "ALT" not specified
..
...Over="music7()" onMouseOut="music8()">
✉
5. Error Line 79, column 111: required attribute "ALT" not specified
..
...Over="music1()" onMouseOut="music2()">
✉
6. Error Line 80, column 111: required attribute "ALT" not specified
..
...Over="music3()" onMouseOut="music4()">
✉
7. Error Line 81, column 112: required attribute "ALT" not specified
..
...Over="music5()" onMouseOut="music6()"></CENTER>
✉
8. Error Line 82, column 13: there is no attribute "SRC" .
<bgsound src="#" id=music loop=1 autostart="true"><A
class=movelink style="curso
You have used the attribute named above in your document, but the
document type you are using does not support that attribute for this
element. This error is often caused by incorrect use of the "Strict"
document type with a document that uses frames (e.g. you must use the
"Transitional" document type to get the "target" attribute), or by
using vendor proprietary extensions such as "marginheight" (this is
usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported
in the document type you are using, as an undefined element will have
no supported attributes; in this case, see the element-undefined error
message for further information.
How to fix: check the spelling and case of the element and
attribute, (Remember XHTML is all lower-case) and/or check that they
are both allowed in the chosen document type, and/or use CSS instead of
this attribute.
✉
9. Error Line 82, column 20: there is no attribute "ID" .
<bgsound src="#" id=music loop=1 autostart="true"><A
class=movelink style="curso
✉
10. Error Line 82, column 31: there is no attribute "LOOP" .
<bgsound src="#" id=music loop=1 autostart="true"><A
class=movelink style="curso
✉
11. Error Line 82, column 43: there is no attribute "AUTOSTART" .
...nd src="#" id=music loop=1 autostart="true"><A class=movelink
style="cursor:m
✉
12. Error Line 82, column 49: element "BGSOUND" undefined .
...="#" id=music loop=1 autostart="true"><A class=movelink
style="cursor:move;"
You have used the element named above in your document, but the
document type you are using does not define an element of that name.
This error is often caused by:
* incorrect use of the "Strict" document type with a document
that uses frames (e.g. you must use the "Frameset" document type to get
the "<frameset>" element),
* by using vendor proprietary extensions such as "<spacer>"
or "<marquee>" (this is usually fixed by using CSS to achieve the
desired effect instead).
* by using upper-case tags in XHTML (in XHTML attributes and
elements must be all lower-case.
✉
13. Error Line 88, column 32: required attribute "TYPE" not specified
..
<script language="JavaScript1.2">
✉
Source Listing
Below is the source input I used for this validation:
1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
2. <HTML>
3. <HEAD><TITLE>Free Scripts And Tools For Webmasters @
www.AceJS.com</TITLE>
4. </HEAD>
5. <BODY>
6. <STYLE type="text/css">
7. .topbox
{background-color:#78D2FF;border-style:none;font-family:arial;font-size:7px;}
8. .mainL
{width:131px;border-style:ridge;border-width:5px;border-color:#0022FF;position:absolute;
background-color:#78D2FF;visibility:show; left:20px; top:20px;
z-index:2;}
9. a.movelink {color:#000000; text-decoration:none;
font-family:arial; font-size:7px;}
10. </STYLE>
11. <div id="movmenu" class=mainL>
12. <table class=topbox border=0 width=100%>
13. <tr>
14. <td>
15. <SCRIPT LANGUAGE="JavaScript">
16. var musiccount=1;
17. function playmusic(){
18. if ((musiccount > 10) || (musiccount < 1)){musiccount=1;}
19. if (musiccount==1){document.all.music.src="1.mid";} // 1.mid is
the file name of the first music file, 2.mid is the name of the second
music file and so on. Change the file name of to the file name you need
but make sure that you change all occurrences of the file name to the
new name
20. if (musiccount==2){document.all.music.src="2.mid";}
21. if (musiccount==3){document.all.music.src="3.mid";}
22. if (musiccount==4){document.all.music.src="4.mid";}
23. if (musiccount==5){document.all.music.src="5.mid";}
24. if (musiccount==6){document.all.music.src="6.mid";}
25. if (musiccount==7){document.all.music.src="7.mid";}
26. if (musiccount==8){document.all.music.src="8.mid";}
27. if (musiccount==9){document.all.music.src="9.mid";}
28. if (musiccount==10){document.all.music.src="10.mid";}
29. }
30. function stopmusic(){
31. document.all.music.src='';
32. }
33. function forwardmusic(){
34. musiccount++;
35. if ((musiccount > 10) || (musiccount < 1)){musiccount=1;}
36. if (musiccount==1){document.all.music.src="1.mid";}
37. if (musiccount==2){document.all.music.src="2.mid";}
38. if (musiccount==3){document.all.music.src="3.mid";}
39. if (musiccount==4){document.all.music.src="4.mid";}
40. if (musiccount==5){document.all.music.src="5.mid";}
41. if (musiccount==6){document.all.music.src="6.mid";}
42. if (musiccount==7){document.all.music.src="7.mid";}
43. if (musiccount==8){document.all.music.src="8.mid";}
44. if (musiccount==9){document.all.music.src="9.mid";}
45. if (musiccount==10){document.all.music.src="10.mid";}
46. }
47. function rewindmusic(){
48. musiccount--;
49. if ((musiccount > 10) || (musiccount < 1)){musiccount=1;}
50. if (musiccount==1){document.all.music.src="1.mid";}
51. if (musiccount==2){document.all.music.src="2.mid";}
52. if (musiccount==3){document.all.music.src="3.mid";}
53. if (musiccount==4){document.all.music.src="4.mid";}
54. if (musiccount==5){document.all.music.src="5.mid";}
55. if (musiccount==6){document.all.music.src="6.mid";}
56. if (musiccount==7){document.all.music.src="7.mid";}
57. if (musiccount==8){document.all.music.src="8.mid";}
58. if (musiccount==9){document.all.music.src="9.mid";}
59. if (musiccount==10){document.all.music.src="10.mid";}
60. }
61. function music1(){
62. document.plbtn.src="play2.gif";}
63. function music2(){
64. document.plbtn.src="play1.gif";}
65. function music3(){
66. document.stbtn.src="stop2.gif";}
67. function music4(){
68. document.stbtn.src="stop1.gif";}
69. function music5(){
70. document.ffbtn.src="ff2.gif";}
71. function music6(){
72. document.ffbtn.src="ff1.gif";}
73. function music7(){
74. document.rrbtn.src="rr2.gif";}
75. function music8(){
76. document.rrbtn.src="rr1.gif";}
77. </SCRIPT><CENTER>
78. <img src="rr1.gif" BORDER="0" onClick="rewindmusic()"
name="rrbtn" onMouseOver="music7()" onMouseOut="music8()">
79. <img src="play1.gif" name="plbtn" BORDER="0"
onClick="playmusic()" onMouseOver="music1()" onMouseOut="music2()">
80. <img src="stop1.gif" onClick="stopmusic()" name="stbtn"
BORDER="0" onMouseOver="music3()" onMouseOut="music4()">
81. <img src="ff1.gif" BORDER="0" onClick="forwardmusic()"
name="ffbtn" onMouseOver="music5()" onMouseOut="music6()"></CENTER>
82. <bgsound src="#" id=music loop=1 autostart="true"><A
class=movelink style="cursor:move;" onclick="InitializeMove()">
83. Click to move, Double Click to stop</A></td>
84. </tr>
85. </table>
86. </div>
87. <div id="emptycell" style="position:absolute; visibility:show;
left:-70px; top:-70px; z-index:2"></div>
88. <script language="JavaScript1.2">
89.
90. var XX = -70;
91. var YY = -70;
92. var cur_one = "emptycell"
93. var moving = false;
94. var xpos1 = 20;
95. var ypos1 = 20;
96. var myX = 0;
97. var myY = 0;
98.
99. function InitializeMove() {
100. cur_one = "movmenu";
101. XX = eval("xpos1");
102. YY = eval("ypos1");
103. }
104.
105. function CaptureMove() {
106. if (document.layers) document.captureEvents(Event.MOUSEMOVE);
107. }
108.
109. function EndMove() {
110. if (document.layers) document.releaseEvents(Event.MOUSEMOVE);
111.
112. cur_one = "emptycell"
113. moving = false;
114. document.close();
115. }
116.
117. function WhileMove() {
118.
119. if (document.all) {
120. eval(cur_one+".style.left="+myX);
121. eval(cur_one+".style.top="+myY);
122. }
123.
124. if (document.layers) {
125. eval("document."+cur_one+".left="+myX);
126. eval("document."+cur_one+".top="+myY);
127. }
128. }
129.
130. function MoveHandler(e) {
131.
132. myX = (document.all) ? event.clientX : e.pageX;
133. myY = (document.all) ? event.clientY : e.pageY;
134.
135. if (!moving) {
136. diffX = XX - myX;
137. diffY = YY - myY;
138. moving = true;
139. if (cur_one == "emptycell") moving = false;
140. }
141. myX += diffX;
142. myY += diffY;
143.
144. if (moving) {
145. xpos1 = myX;
146. ypos1 = myY;
147. }
148.
149. WhileMove();
150. }
151.
152. function ClearError() {
153. return true;
154. }
155.
156. if (document.layers) {
157. document.captureEvents(Event.CLICK);
158. document.captureEvents(Event.DBLCLICK);
159. }
160. document.onmousemove = MoveHandler;
161. document.onclick = CaptureMove;
162. document.ondblclick = EndMove;
163. window.onerror = ClearError;
164. WhileMove();
165. </script>
166. <P>
167. <B><A HREF="http://www.AceJS.com">AceJS.com</A> The JavaScript
Directory</B>
168. </BODY>
169. </HTML>