View Full Version : need help with Js and html anchor tags

01-20-2009, 10:57 PM
Hi some time ago i posted a thread here but never got resolved, sorry if i trouble you people, pls don't flame :o.
i've been working alot on the site but just can't seem to get this bloody script to work, and my JavaScript knowledge is below basics :S

i got this script that is for loading the HTML tag <anchor>(<a>) in a MediaPlayer on the site.
right now, when the function init() gets activated it works just fine. only problem is that when i wanna surf to other pages the function init stays active and the urls gets send to the mediaplayer.


function init () {
var x = document.getElementsByTagName ('a');
for (i = 0; i < x.length; i++) {
x[i].onclick = function () {
document.getElementById('media').innerHTML = "<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+ this.href +"' name='MediaPlayer1' width='217' height='84' controltype='1' showcontrols='1' showstatusbar='0' AutoStart='true'></embed> ";
return false;

maybe the problem would be fixed if document.getElementsByTagName ('a');
only works when the anchor has some type of name/title in it something like <a name="RadioA" href="mms://strm-4.us.medianova.tv/KRALFM_64?MSWMExt=.asf"> i honestly don't know :S

pls help you will have my eternal grattitude

i don't know if i am allowed to post the site what im trying to fix, so i'll post it when asked for :o

01-20-2009, 11:00 PM
i don't know if i am allowed to post the site what im trying to fix, so i'll post it when asked for

Please post a link to the page on your site that contains the problematic script so we can check it out.


01-20-2009, 11:05 PM
kewl thnx,
the site is in a another language so sorry about that

you have on the left side a box called "en cok dinlenen" and in a div i have the function put in <div "links_favoryradyo" onMouseove="init()">

01-21-2009, 03:54 PM
resolved the problem by not using the javascript but making a new page and using PHP $_GET, thnx enyways