onclick pass url and execute remote script problem
I have a menu system that I want to be able to onclick pass a url to a <script></script> (located in the main content of the page) where the url passed replaces the 'src' of that script.
The reason is because a lot of the links are syndicated content, and instead of having 10 or 20 extra pages just to load that content, I want to dynamically change the script src.
I don't think it's passing my variable because it's a url or something.
<!--script that does all the work-->
var new_var = pass;
<!--menu part that activates the onclick and function, thus changing the content-->
<li><a href="#" onclick="synchange('http://content.cdsbe.com/_utility/ibmrdr/www.live.hal.webcollage.net/server/yorel/hal-showcase?ws-entry=halsrv-i-series-landing-page')">System i</a></li>
<!--goes in the main content junk where syndicated content shows up-->
<script id="cursyncon" src="#"></script>
thanks again for any help...!
bump. if any insight, I would be very grateful...
It doesn't matter where you put a script tag, if you insert it after the page has loaded.
Replacing or removing a script element does not remove any loaded script, it just adds the script from the new source to the global object. The original script is still in existence, though the new code may overwrite or break it.
You can add a new script element, but you cannot call any of its functions or use any of its objects until it is loaded and interpreted. You can use the script elements onload or readystatechange event, or use a timer to check for some property set in the script. If the script was on your own domain you could fetch it and run a callback with Ajax.
thank you very much, I will look into those other ideas.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)