2011-04-12 67 views
0

我正在使用一个jQuery图像滑块,我想通了,如何将图像从数据库传递到我的图像滑块,但即时通讯的描述文本传递给每个图像的问题,因为图像形成是在脚本中,我不知道如何将eval(“描述”)传递给脚本。下面是代码:将描述文本从数据库传递给jquery图像滑块

<script type="text/javascript"> 
       if (!window.slider) var slider = {}; 
       slider.data = [{ "id": "slide-img-1", "client": "nature beauty", "desc": "With up to 30 used caravans for you to choose from, you will soon be able to hit the open road...<br /> Come along and browse at your leisure or take a look at a selection of our current stock." }, { "id": "slide-img-2", "client": "nature beauty", "desc": "" }, { "id": "slide-img-3", "client": "nature beauty", "desc": "add your description here" }, { "id": "slide-img-4", "client": "nature beauty", "desc": "add your description here" }, { "id": "slide-img-5", "client": "nature beauty", "desc": "add your description here" }, { "id": "slide-img-6", "client": "nature beauty", "desc": "add your description here"}]; 

,所以我想通过类似 “说明”: '<%的eval( “说明”)%>'

<div id="slide-runner"> 

<asp:Repeater ID="rptJquery" runat="server"> 

<ItemTemplate> 
<a href=""> 
<img ID='<%#Eval("slideshowID") %>' src='<%#String.Format("/images/slideshow/{0}", Eval("imgURL"))%>' class="slide"/> 
</a> 
</ItemTemplate> 
</asp:Repeater> 
</div> 
+0

是<%#Eval(“说明”)%>不适用于您?我的意思是你试过了吗? – 2011-04-12 21:10:29

+0

没有它的不工作,我想你不能使用它在javascripting – 2011-04-13 09:10:21

回答

0

的最佳方式实现这种情况,就是将数据提供为JSON,并且在加载图像滑块时,在初始化时提供此数据。

如果您正确提供,插件应该正确处理这种类型的数据。

如果您可以告诉我们您的插件的名称,也许我们可以为您提供一些样品。

+0

thnx为你的reple,下面是我用于我的项目的图像库链接:http://www.dreamcss.com/2009/04/ create-beautiful-jquery-sliders.html,可以为我提供任何有关上述场景的阴影 – 2011-04-13 09:48:40