0

我正在为我的网站 (ASP.net MVC) 使用 WowSlider( http://wowslider.com/ ) 图像滑块。当我在 Img 标题中使用简单文本时,它会正确显示标题

<img src="~/Content/data1/images/01_____.jpg" 
              title="my image title" alt="my image title" id="wows1_0" />

但是当我想从我的资源文件 (.resx) 中获取标题时,它只会读取第一个单词!

<img src="~/Content/data1/images/01_____.jpg" 
                  title=@Resources.HomeIndexRes.SliderImg01 alt=@Resources.HomeIndexRes.SliderImg01 id="wows1_0" />

我应该怎么做才能让它阅读完整的标题?

我的完整索引代码如下:

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}

 <!-- Start Slider HEAD section --> 
 <link rel="stylesheet" type="text/css" href="~/Content/engine1/style.css" 
/>
 <script type="text/javascript" src="~/Content/engine1/jquery.js"></script>
<!-- End Slider HEAD section -->
<link href="~/Content/StyleSheet.css" rel="stylesheet" />


<!-- Start Slider BODY section -->
<div id="wowslider-container1">
<div class="ws_images">
    <ul>
        <li ><img src="~/Content/data1/images/01_____.jpg" 
                  title=@Resources.HomeIndexRes.SliderImg01 
alt=@Resources.HomeIndexRes.SliderImg01 id="wows1_0" /></li>
        <li><img src="~/Content/data1/images/02_________.jpg" 
                 title=@Resources.HomeIndexRes.SliderImg02  
alt=@Resources.HomeIndexRes.SliderImg02  id="wows1_1" /></li>
        <li><img src="~/Content/data1/images/03______.jpg" 
                 title=@Resources.HomeIndexRes.SliderImg03  
alt=@Resources.HomeIndexRes.SliderImg03 id="wows1_2" /></li>
        <li><img src="~/Content/data1/images/04______.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg04  
 alt=@Resources.HomeIndexRes.SliderImg04 id="wows1_3" /></li>
        <li><img src="~/Content/data1/images/05____.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg05  
 alt=@Resources.HomeIndexRes.SliderImg05 id="wows1_4" /></li>
        <li><img src="~/Content/data1/images/06_______.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg06  
alt=@Resources.HomeIndexRes.SliderImg06 id="wows1_5" /></li>
        <li><img src="~/Content/data1/images/07_____.jpg" 
                 title=@Resources.HomeIndexRes.SliderImg07  
alt=@Resources.HomeIndexRes.SliderImg07 id="wows1_6" /></li>
        <li><img src="~/Content/data1/images/08_______.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg08  
 alt=@Resources.HomeIndexRes.SliderImg08 id="wows1_7" /></li>
        <li><img src="~/Content/data1/images/09_____.jpg" 
                 title=@Resources.HomeIndexRes.SliderImg09  
 alt=@Resources.HomeIndexRes.SliderImg09 id="wows1_8" /></li>
        <li><img src="~/Content/data1/images/10_____.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg10  
 alt=@Resources.HomeIndexRes.SliderImg10 id="wows1_9" /></li>
    </ul>
    </div>
    <div class="ws_shadow"></div>
</div>
 <script type="text/javascript" src="~/Content/engine1/wowslider.js">
</script>
<script type="text/javascript" src="~/Content/engine1/script.js"></script>
<!-- End Slider BODY section -->
4

1 回答 1

1

如果属性值中有空格,请在属性值周围加上引号title,否则该值将只是第一个单词。

title="@Resources.HomeIndexRes.SliderImg01"

于 2017-11-09T18:16:01.307 回答