Solved

button click event-- add script

Posted on 2014-12-13
1
74 Views
Last Modified: 2014-12-14
Hello,
  I have a javascript function that I would like loaded to the head section when a button click happens. Is this possible? and how can I do it


here is script

<script type='text/javascript' src='https://www.dropbox.com/static/api/2/dropins.js' ></script>

Here is what I tying to accomplish. I want to add dropbox.js to my page and a dropbox picker. However, this service is block in  some network.So, my page load for a while if Drop Box is not allow. I would like to only incur this penalty when the button is press.

Thanks
0
Comment
Question by:SiemensSEN
1 Comment
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
Comment Utility
<script>
function button_click(){
	dynJs=document.createElement('script')
	dynJs.setAttribute("src", "https://www.dropbox.com/static/api/2/dropins.js")
	document.getElementsByTagName("head")[0].appendChild(dynJs)
}
</script>

Open in new window

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now