embed a plugin after a button click

This is a discussion on "embed a plugin after a button click" within the JavaScript Forum section. This forum, and the thread "embed a plugin after a button click are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 13th, 2005, 12:36
SuperMember

SuperMember
Join Date: Dec 2005
Location: Netherlands
Age: 46
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
embed a plugin after a button click

Hi everybody,

I'm still very new in using HTML. Being an amateur Visual Basic programmer, I run into a few problems that seem simple, but I can't find the solution (yet).
I want to use a button click (of a self made button (or image) to start a mp3 to play. I wanted to use the <embed> tag, because I want the plugin (quicktime) to show up next to the pressed button. A Member of the HTML forum suggested to use javascript. Since I don't know any javascript (yet) I hope somebody on this forum can help me out here.

Thanx
Reply With Quote

  #2 (permalink)  
Old Dec 13th, 2005, 12:42
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,953
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: embed a plugin after a button click

Basically you will need to use the button / images on click event to call a function. The function will simply write out the required HTML using javascript's 'document.write' funtions.

Have a go at doing this yourself because it really isnt that hard..... post your code if you get stuck......... We *could* do this for you, but then what do you learn?

Research a little about "onclick" and "document.write" and you'll be there in no time.

Regards,
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #3 (permalink)  
Old Dec 13th, 2005, 15:39
SuperMember

SuperMember
Join Date: Dec 2005
Location: Netherlands
Age: 46
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Re: embed a plugin after a button click

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Alert Box</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<img src="Plaatjes/Algemeen/KnopOut.gif" width="160" height="63" onClick="mijnfunctie()">
function mijnfunctie()
{
<script language="javascript" type="text/javascript">
<!--
document.write("<embed src='Muziek/A Brand New Year (LR).mp3' autostart = 'true'");
//-->
</script>
}
</body>
</html>


results in showing img + text: function mijnfunctie() {
+ qtime plugin
and starts embedded song straight away without a mouseclick on the image.

What did I do wrong ?

Last edited by VanderBOOM; Dec 13th, 2005 at 16:47.
Reply With Quote
  #4 (permalink)  
Old Dec 13th, 2005, 17:24
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,953
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: embed a plugin after a button click

First of all, when posting code, please use code tags, eg.
([code]your code here[/code] ... or in this specific case, [html]your HTML code here[/html])

Lets see.... you have an error in your html... try this:-
HTML: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Alert Box</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<img src="Plaatjes/Algemeen/KnopOut.gif" width="160" height="63" onClick="mijnfunctie()" />
<script language="javascript" type="text/javascript">
<!--
function mijnfunctie()
{
document.write("<embed src='Muziek/A Brand New Year (LR).mp3' autostart = 'true' />");
}
//-->
</script>
</body>
</html>
I'm sure there is a lot more embed code needed... prolly <objcet> need too to make this work Xbrowser.... since i never deal with audio and webpages, maybe someone else can help further.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work

Last edited by Rob; Dec 13th, 2005 at 17:28.
Reply With Quote
  #5 (permalink)  
Old Dec 13th, 2005, 19:27
SuperMember

SuperMember
Join Date: Dec 2005
Location: Netherlands
Age: 46
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Re: embed a plugin after a button click

Thanks Rob, this does the trick. I found out that the {} were placed wrong, and I forgot to place a > behind the true'. Good learning moment.

regards Hans
Reply With Quote
  #6 (permalink)  
Old Dec 14th, 2005, 10:33
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,953
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: embed a plugin after a button click

Actually.... if you look closer, you'll see your script tags were also in the wrong place and you never closed the embed tag...... true though... a good learning excercise.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
Reply

Tags
embed, plugin, button, click

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help using object/embed tags to embed java applet Jon1123 Web Page Design 2 Apr 10th, 2007 22:31
automatic pop-up when click on a radio button joshcxa JavaScript Forum 2 Aug 1st, 2006 06:06
Using a button click to activate an <embed> VanderBOOM Web Page Design 1 Dec 9th, 2005 15:54
on click button Monie JavaScript Forum 1 Aug 30th, 2004 06:20


All times are GMT. The time now is 19:06.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43