Solved

<EMBED> tag and document.writeln

Posted on 1997-07-03
5
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

688 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