Solved

<EMBED> tag and document.writeln

Posted on 1997-07-03
5
347 Views
Last Modified: 2011-10-03
As posted in comp.infosystems.www.authoring.html:

In a vein attempt to create an interactive web-page, I tried using
JavaScript to play a sound on a MouseOver event.  This is a sample of what
I tried to do.
--------------------------
<HTML>
<HEAD>
<SCRIPT>
function play() {
      document.writeln('EMBED SRC=\"SOUND.WAV\" HIDDEN=TRUE')
}
</SCRIPT>
</HEAD>
<BODY>
<A HREF="Href.htm" onMouseOver=play()><IMG SRC="Image.gif"></A>
</BODY>
--------------------------

This _should_ work, but all it does is 'hang' (just sits loading something)
in IE, or starts a new page in NS.

Any ideas?  (I wish to be able to use the  tag, I know this kind of
thing can be done with a window.location command [ie
window.location="SOUND.WAV", but this results in a download dialog, client
window (by default), etc.)

Shanon Olsson
freddo@iaccess.com.au
0
Comment
Question by:Shanon070197
5 Comments
 

Author Comment

by:Shanon070197
ID: 1268017
Edited text of question
0
 

Author Comment

by:Shanon070197
ID: 1268018
Edited text of question
0
 
LVL 5

Accepted Solution

by:
Trevor013097 earned 100 total points
ID: 1268019
What you currently have will not work because it is trying to modify the page once it has already been loaded and that is not possible using HTML at present (excluding the new 4th generation Dynamic HTML).  The options available are to use frames to write the HTML to or instead (and the one I prefer) is to EMBED the sound and simply alter its properties on the fly using Javascript;

Try this it works by simply changing the EMBEDded sounds play state.

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
function start()  {
      document.the-name.play(false);
      }
</SCRIPT>


<BODY>

<EMBED SRC="filename.wav" HIDDEN=TRUE AUTOSTART=FALSE NAME="the-name" MASTERSOUND>

<a href="Href.htm" onMouseover="start()";>Start Music</A>

</BODY>

</HTML>

Hope its works for you it does for me.


0
 

Expert Comment

by:tkchan
ID: 1268020
But this doesn't work in IE3/4/5beta!
0
 

Expert Comment

by:Blessy
ID: 2903333
I need to embed an excel sheet using <EMBED> tag.  Is it possible with the same logic?  Or can you post the code?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question