Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2006, 10:21 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default dynamically link js file

Hi,

Is there a way to add js files on the fly depending on what the user selects for options?

 
Old September 12th, 2006, 11:46 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

HIii DarkHalf!!
Offcource you can do this,
plz try it

***********test.html*******
<script language=javascript>
function replaceJS()
{
obj=document.getElementById("myjs1")
obj.src="myjs2.js"
}
</script>
<script id="myjs1" src="myjs1.js"></script>
<input type=button onclick="alertme()" value="showval">
<input type=button onclick="replaceJS()" value="replaceJS">
**********test.html end************

********* myjs1.js Start************


**********function alertme(){
alert("mee1")
}
********* myjs1.js End************


********* myjs2.js Start************


**********function alertme(){
alert("mee2")
}
********* myjs2.js End************

Hope this will help you :)

Cheers :)

vinod
 
Old September 13th, 2006, 06:59 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you!

 
Old September 15th, 2006, 09:05 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

;)

Cheers :)

vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to link slideshow images on js gilgalbiblewheel Javascript How-To 1 January 25th, 2007 07:16 AM
how 2 add or remove .js dynamically in my pages nerssi Javascript 2 September 21st, 2006 09:14 AM
Thoughts on Dynamically assigning external js file fs22 Javascript 1 June 23rd, 2004 02:12 PM
Advice on Dynamically assigning external js file fs22 Javascript 9 June 10th, 2004 05:26 PM
Dynamically assign external js file fs22 Javascript How-To 1 May 21st, 2004 05:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.