开发者

dynamically generating a redirect to an mp3 file with php and javascript

I'm trying to generate the link to the mp3's in my site dynamically using the following code:

<a href="<?php echo "<script language=javascript>location.href='$thisTitle.mp3'</script>";?>" target="_blank" onClick="javascript:PlayerOpen('LFO&amp;#8217;s Revenge',this.href);
return false">Click Me to Hear a Sample</a>

This results in the following url:

http://www.example.com/site/_main_nav/<script language=javascript>location.href='Title 1.mp3'</script>

$thisTitle gets Title 1 from the mysql database.

Do you know how I could fix this? I can't use header('$thisTitle.mp3') because my included header file has already sent the header info which can't be modified. I can't call the included header after this line of code either.

I use the same javascript redirect code in my index file to link to the welcome page:

echo "<script language=javascript>location.href='_main_nav/welcome.php'</script&开发者_如何学Cgt;";

It redirects properly without the javascript code being spat out in the resulting url.

I have the Title 1.mp3 in the _main_nav folder.


change it to

<a href="<?php echo "$thisTitle.mp3";?>" target="_blank" onClick="javascript:PlayerOpen('LFO&amp;#8217;s Revenge',this.href); return false">Click Me to Hear a Sample</a>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜