Solved

<EMBED> tag and document.writeln

Posted on 1997-07-03
5
333 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now