I'm looking to dynamically change the flash files based from an hyperlink on the page without the page having to reloading. Is this possible through javascript?
views:
111answers:
2
A:
Do you mean you want to change the destination of a hyperlink on the page through javascript? Something like this should do that:
<body>
<a id="test" href="http://www.google.com">Go to Google</a>
<input type="button" onclick="document.getElementById('test').href = 'http://www.yahoo.com'" value="Go to Yahoo"/>
</body>
Or are you trying to do something different? Like changing what Flash is displayed by clicking a hyperlink? Haven't tried it, but the above approach might work there, too, with a little tweaking. Remember that the attributes of an element (like the href above) are available in javascript as properties once you have a reference to the element, so you should be able to change whatever attribute of the element you need to.
Ryan Mitchell
2010-03-06 18:33:00
A:
Yes, it's possible. See this tutorial: http://learnswfobject.com/advanced-topics/load-a-swf-using-javascript-onclick-event/
pipwerks
2010-03-07 09:12:49
Awesome, exactly what I was looking for.
craig
2010-03-07 22:46:32