Click to See Complete Forum and Search --> : What do I enter for this URL?


Pure L
03-14-2007, 12:19 AM
Ugh.

My first post, and I already messed things up. (I didn't put a proper title in):(

Please ignore my post titled "url" (For some reason I don't see it. I could be just plain blind though).

I'm a newbie and I apologize for seeming so green.

Anyway, I'm trying to make a web page using Visual Web Developer 2005 (express edition).

In this page, I'm trying to create a .wav player. All of the code is listed here (http://blogs.msdn.com/coding4fun/archive/2007/01/24/1525816.aspx).

In this code, there are 4 places where the author has typed "(url)". My question is this: What do I--specifically--enter where this "(url)" has been written. I'm assuming that's where I put the url to the sound I want to be played.

Right now that sound is located here: sounds/tada.wav

Do I enter "sounds/tada.wav" in all instances of the author's mention of "(url)" in the code listed on the aforementioned page?

For example, the 4 spots in the code that call this "(url)" are here:
1) playSound = function(url)
2) snd.src = url;
3) playSound = function(url)
4) obj.data = url;

I hope this makes sense. Thanks.

Nedals
03-14-2007, 02:21 AM
Do I enter "sounds/tada.wav" in all instances of the author's mention of "(url)" in the code listed on the aforementioned page?
Yes and No!

Better to edit the code like this
function setupPlaySound(url) {
..
}

You now pass the url into the function
setupPlaySound('sounds/tada.wav')

Pure L
03-14-2007, 11:13 AM
Thanks, Nedals.

I'm still a bit confused though.....

So, do I enter "sounds/tada.wav" for every instance of "(url)" mentioned in the code?

Including the part in your suggestion?

(i.e. function setupPlaySound(url) {
..
} )

If yes, then it'd look like this?

function setupPlaySound("sounds/tada.wav"){

}

Thanks!

Nedals
03-14-2007, 09:02 PM
So, do I enter "sounds/tada.wav" for every instance of "(url)" mentioned in the code?
No! You really need to read up on using functions

function setupPlaySound(url) {
..
}
url is a variable that is used within the function. You parse the value of that variable using...
setupPlaySound('sounds/tada.wav')

..which will appear somewhere in your HTML (or maybe within another javascript function)

... onmouseover = "setupPlaySound('sounds/tada.wav')"...

Pure L
03-14-2007, 09:35 PM
No! You really need to read up on using functions



I know. I'm gonna do some of that tonight.

Just curious....are there any good books on tape or anything that you'd recommend?

Your help is much appreciated.

Nedals
03-14-2007, 09:47 PM
books ON TAPE ??? :)

This site has a lot of good tutorials.
http://www.w3schools.com/

thechasboi
03-21-2007, 01:33 PM
A function is a bunch of code put together to do stuff, what ever it is, then it returns a value gotten or calculated or what ever from the code. You do not necessarily need to return something in a function but that is what a function is. Some times functions contain member parts like other function and this is where things get a little more confusing but for your case I think you should just use the function as a black box. Send the appropriate info get the appropriate response. Hope this helps.