Web Site Graphics Code
Animations Sounds Videos Java Programs Help
|
Chapter 7
Multimedia |
musicpage.html, skatepage.html, gamespage.html |
The last three pages you make (to complete your website) are copies of "homepage.html". They each have extra multimedia elements:
- "musicpage.html" has an <EMBED> tag that plays a sound whenever the page is loaded.
The <EMBED> tag can be placed anywhere in the code. You can't "see" a sound, so the <EMBED> tag appears as a grey rectangle. To get around this, make it 1 pixel wide and 1 pixel high so it hardly shows:
<EMBED SRC="sounds/drums.wav"
AUTOSTART=TRUE
LOOP=FALSE
ALIGN=CENTER
WIDTH=1
HEIGHT=1>
</EMBED>
Using a search engine such as to find some more small WAVE sound files.
- "skatepage.html" also using <EMBED>, but this time for a video. It is necessary to set the width and height this time so that the video can be seen!
<EMBED SRC="videos/skatevideo1.mpg"
AUTOSTART=TRUE
LOOP=FALSE
ALIGN=CENTER
WIDTH=320
HEIGHT=192>
</EMBED>
This <EMBED> tag can also be inserted anywhere in your page. It is best to put it in the <!-- content --> section.
Use a search engine to find some free MPEG or AVI videos to use - or you could make your own using a Digital Video Camera.
The best types of videos for web pages are ones which end in ".mpg" or ".avi". Save them to your "videos" folder and add another <EMBED> tag, then change change the "SRC" parameter to the new video.
- "gamespage.html" makes use of the <APPLET> tag to add a Java Applet. Java is supported by most modern browsers, and there are millions of Java Applets on the web that you could include on yur page - from fancy menus to scrolling text, from visual and audio effects to neat games.
The simplest type of Java Applets are called CLASS files, such as "game1.class". They are easy to add to a page:
<APPLET CODE="game1.class"
ALIGN=CENTER
WIDTH=30
HEIGHT=250>
</APPLET>
Often, more complex Java programs - such as those with images, sounds, moving graphics, animations or other effects - can be found as ZIP files, e.g. "my-applet.zip". These must be unzipped into your "My Website" folder. The ZIP file will contain one or more CLASS files, and possibly some image and sound files. The CLASS files must go in the same folder as your HTML files. Add these types of Applet to a page in the same way as "game1.class".
The last type of Java Applet is called a JAR file, such as "racingcars.jar". These only work in more recent browsers, but a superior to other types of Applet. They can contain many CLASS files, images, sounds (and more) all in one JAR file - but you do not need to unzip anything. Download the JAR file into the same folder as your HTML pages, and add code in this form to your web page:
<APPLET ARCHIVE="racingcars.jar"
CODE="racing.class"
ALIGN=CENTER
WIDTH=30
HEIGHT=250>
</APPLET>
The browser reads the whole "racingcars.jar" file and find "racing.class" inside it, ands displays it on your screen.
What are you waiting for? Go to www.javaboutique.com and get some Applets!
Most Applet sites come with some instructions to help you add them your page.
For more information, go to payne-gallway.co.uk/basichtml/java.
|
|
|