...

View Full Version : Execute a script when a user clicks the button



praveev
12-29-2010, 12:27 AM
Hi Everyone,

I want to execute a script when the user clicks the button.

Currently in my html doc. i have the button declared.
<input type="button" id ="button" onclick='notEmpty() value="Play"/>

When the button is clicked, i execute the notEmpty() function and I want to execute a script inside the notEmpty(). How can i do this?

Thanks,
Praveen

Old Pedant
12-29-2010, 12:38 AM
Ummm...notEmpty *IS* a script.

It must be a JavaScript function by that name.

I should note that you are missing an apostrophe there: You do onclick='notEmpty() and that's not legal. You *MUST* have the matching apostrophe: onclick='notEmpty()' though it would be better to use quote marks: onclick="notEmpty()"

Where is your code for notEmpty? What does it do? What do you want it to do?

praveev
12-29-2010, 12:46 AM
yes. u are right. i missed an apostrophe on my last post.

I want to implement the code below in my notEmpty() function. I want to implement the "src" inside the function.

<script
type="text/javascript"
src="http://gdata.youtube.com/feeds/api/videos?q=puppy&alt=json-in-script&callback=showMyVideos2&max-results=30&format=5">
</script>

Old Pedant
12-29-2010, 02:08 AM
Ahhh...now I see what you mean. I'll have to let somebody else answer. I know there are ways to invoke stuff like that dynamically, but it's not obvious how.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum