带有jquery的变量容器

时间:2011-01-20 16:23:32

标签: jquery hyperlink var

我正在寻找一种使用jquery变量的方法。

我从超链接抓取src attribbute。

但我想把它附加到jw player的hyerlink上。

 '640','467','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file','I need the href attribute to go in here');
so.write('mediaspace');

我的问题是他们没有div附加它,我不能在这个空间放任何东西来支持它,因为它只需要是超链接。

<a class="video_click" href="video/link.flv" rel="prettyPhoto" title="Flash 10 demo"><?php echo "$fname"; ?></a>

<script type="text/javascript">

$('a.video_click').click(function(event){
event.preventDefault();

var test = $(this).attr('href');
alert(test);

}); 

所以我抓住了href他们是一种附加说{$name}之类的东西?

1 个答案:

答案 0 :(得分:0)

你正在寻找jQuery.data()吗?

http://api.jquery.com/jQuery.data/

它允许您使用元素存储任意数据并在以后访问它。