English 中文(简体)
如何从服务器中确定Sttar Rating widget的初步价值
原标题:How to set initial value of Star Rating widget from server
  • 时间:2011-10-24 03:00:34
  •  标签:
  • jquery
  • html

我正在利用Star Rating widget和I m试图从服务器回来的价值中确定植被的最初价值。 我知道这个原则是将缺省办法定在<>条码>上,但我可以说明如何。 有些植被有<代码>Default方法,但这不是一种方法,因此必须采取另一种方式。

任何帮助都很麻烦。

页: 1

<div id="stars_content" style="padding-top:6px;">
            <select id="ContentRating" name="ContentRating">
                <option value="1">Very Poor</option>
                <option value="2">Poor</option>
                <option value="3">OK</option>
                <option value="4">Good</option>
                <option value="5">Very Good</option>
            </select>
            <span id="content_hover" style="padding-left:5px;"></span>
</div>

这里是 j:

$("#stars_content").stars({
        inputType: "select",
        captionEl: $( #content_hover )
    });
最佳回答

你可以人工操作

$("#stars_content option[value=3]").attr("selected",true);

这应当做到。

EDIT

http://orkans-tmp.22web.net/star_ating/htm/star-examples.htm?b44” rel=“nofollow” 。

$("#stars-wrapper1").stars("select", 1); // select first Star (see element Value in HTML source)

因此,你的法典将会是

$("#stars_content").stars({
    inputType: "select",
    captionEl: $( #content_hover ),
    select:3
});

...... 我认为,我相信,我会认为,我相信,我会认为,我相信,我会认为,我相信,我会认为,我相信,我会认为,我相信,我会认为,我相信,我会认为,我相信,我会认为,我会认为,我相信,我会认为,我会认为,我相信我会认为,我会认为,我会认为,我会认为,我相信,我会认为,我会认为,我相信,我会认为,我会认为,我相信,我会认为,我相信,我会认为,我会认为,我会认为,我会认为,我会认为,我不认为,我会认为,我会认为,我相信,我会认为,我会认为,我会认为,我相信,我会认为,我会认为,我会认为,我相信,我会认为,我会认为,我会认为,我会认为,我会认为,我相信,我会认为,我认为,我会认为,我相信,我会认为,我会认为,我相信,我会认为,我相信,我会认为,我会认为,我会认为,我

问题回答

我不知道你是如何从服务器上获得“选用率”,但通过<代码>$.get/code>加以应用的。

var selected_rate = 3; //supposing its 3 ( OK )
$( #stars_content option[value=  + selected_rate +  ] ).attr( selected , true)




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签