Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] reassign the script src attribute
- From: mdougherty at pbp.com (Mike Dougherty)
- Subject: [Javascript] reassign the script src attribute
- Date: Wed Aug 17 13:31:59 2005
Are there any caveats to reassigning a script tag's source attribute?
I have two different function bodies with the same name. Ex: Product A uses the SKU() function
in ProductA.js while Product B uses the SKU() function from ProductB.js - on the live website,
there will only ever be a single product for each page and the correct script references are made
while the page is generated. Now I want to move these objects into our intranet, where they will
share the same DHTML container.
Is this possible: (notice the SKU() function is different in each source file)
<script id='productscript' src='productA.js' type='text/javascipt' ></script>
<script type='text/javascript'>
if(productA){ var myobj = new SKU(); }
else {
document.getElementById('productscript').src = 'productB.js' ;
var myobj = new SKU();
}
</script>
- Follow-Ups:
- [Javascript] reassign the script src attribute
- From: Triche Osborne
- [Javascript] reassign the script src attribute
- Prev by Date: [Javascript] parseInt glitch
- Next by Date: [Javascript] reassign the script src attribute
- Previous by thread: [Javascript] parseInt glitch
- Next by thread: [Javascript] reassign the script src attribute
- Index(es):