?
Solved

<EMBED> tag and document.writeln

Posted on 1997-07-03
5
Medium Priority
?
354 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Suggested Courses

777 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