Solved

<EMBED> tag and document.writeln

Posted on 1997-07-03
5
329 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
Comment Utility
Edited text of question
0
 

Author Comment

by:Shanon070197
Comment Utility
Edited text of question
0
 
LVL 5

Accepted Solution

by:
Trevor013097 earned 100 total points
Comment Utility
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
Comment Utility
But this doesn't work in IE3/4/5beta!
0
 

Expert Comment

by:Blessy
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now