Click to See Complete Forum and Search --> : Need debug help


CalifNina
06-04-2003, 06:18 PM
Hello, I give in and need help debugging. New to JS for a couple weeks, have done ok but do not know it well enough to conquer this problem. (( I am playing with JS to get some basics down to be able to eventually take a real class on it ))

Scenario: Built this file piece-by-piece, it runs misc javascript things for a form and other basic HTML tags. The really simple stuff I put together, anything more complicated in javascript I located online or seen examples elsewhere and modified. I'm not done yet but am in glitch for two days now.

(1) Up to this point, everything runs as it should except for one area of "preload and play" script for audio files. YET if I take that same HEAD and BODY code, and place alone into a new file and execute -- the outcome is it works perfectly ---> So I know the code is good.

(2) I cannot figure out why the same "preload and play" script will not work when combined into my overall file. I am not savvy enough to ascertain if something elsewhere is blocking it or if the sound files are not being preloaded?

(3) Would someone pls review my attached file (mycode.html) for a few minutes to see if you notice anything obviously causing friction??

(4) I've identified the HEAD and BODY code with identifying comments so you can easily find it in the file:
<!-- **************************************** -->
<!-- ******** Beginning here in HEAD section ******** -->
<!-- ********** This code does not work *********** -->
<!-- **************************************** -->
<!-- ***** But works perfect if in a separate file ****** -->
<!-- *** with the required script in the BODY section *** -->
<!-- **************************************** -->
.
.
.
<!-- **************************************** -->
<!-- *************** Ending here *************** -->
<!-- **************************************** -->

etc.

P.S. when you run my file the "preload and play" area is the table (with three sections) to select diff options to hear audio files.

Any advice and findings will be appreciated.

gil davis
06-04-2003, 06:45 PM
I've been playing with some music things in NS 4 and ran across an interesting thing that may help.<SCRIPT LANGUAGE="JavaScript">This script tag forces Netscape 4 into JavaScript 1.0 mode. There is no support for the EMBEDS array until JavaScript 1.1. Use <SCRIPT LANGUAGE="JavaScript1.1">to eliminate that problem. IE will pretty much ignore it.

I think the script you started with is overly complicated.

If it will help, here is an example of a simple onclick and onmouseover/out that works in NS 4 and IE 5.5.<a href="#" onclick="document.embeds[0].play();return false">Chimes</a>
<a href="#" onmouseover="document.embeds[1].play()" onmouseout="document.embeds[1].stop()">Ding</a>
<embed src="Chimes.wav" autostart="false" hidden="true" width=0 height=0></embed>
<embed src="Ding.wav" autostart="false" hidden="true" width=0 height=0></embed>

CalifNina
06-04-2003, 11:39 PM
Gil, thks for the reply and suggested code. I'll play around with it and see if I can get it to work ... will let you know the outcome. I don't even use Netscape anymore, have been using only MIE.

I agree the code I found was overly complicated but was what I had to work with. I mean it does work but for some reason not within my overall HTML file.