Html 将选项列表转换为星形
我使用这部分代码对我从MySQL生成的一些文章进行评分。费率是在我的选项列表中完成的,有人可以用数字1、2、3对其进行评分。是否有可能以某种方式将此列表转换为三星(带有单选按钮、图像或其他内容)Html 将选项列表转换为星形,html,css,Html,Css,我使用这部分代码对我从MySQL生成的一些文章进行评分。费率是在我的选项列表中完成的,有人可以用数字1、2、3对其进行评分。是否有可能以某种方式将此列表转换为三星(带有单选按钮、图像或其他内容) 是的,当然,选项很多: 只需使用oldskool链接: <a href="rate.php?idP=<?php echo $idPK; ?>&rating=1"><img src="star.jpg" /></a> <a href="rate
是的,当然,选项很多:
只需使用oldskool链接:
<a href="rate.php?idP=<?php echo $idPK; ?>&rating=1"><img src="star.jpg" /></a>
<a href="rate.php?idP=<?php echo $idPK; ?>&rating=2"><img src="star.jpg" /></a>
<a href="rate.php?idP=<?php echo $idPK; ?>&rating=3"><img src="star.jpg" /></a>
要有创意并发布一些代码
关于html:
<ul class="rating">
<span class="strong"><strong><li class="one"><a href="#">1 Star</a></li></strong></span>
<span class="strong"><strong><li class="two"><a href="#">2 Stars</a></li></strong></span>
<span class="strong"><strong><li class="three"><a href="#">3 Stars</a></li></strong></span>
<span class="strong"><strong><li class="four"><a href="#">4 Stars</a></li></strong></span>
<span class="strong"><strong><li class="five"><a href="#">5 Stars</a></li></strong></span>
</ul>
也许这个链接会有帮助:
看看这些:只有链接的答案在这里是不受欢迎的。你应该在你的答案中贴出那篇文章的相关代码片段,并适当地引用它们。哦,对不起,这是新的。我认为复制粘贴是没有用的。编辑。
<img src="star.gif" class="rating" rel="1" />
<img src="star.gif" class="rating" rel="1" />
<img src="star.gif" class="rating" rel="1" />
$('.rating').on('click', function() {
$.post('rate.php?idP=<?php echo $idPK; ?>', {rating: $(this).attr('rel') }, function() { alert('rating saved'); }
});
<ul class="rating">
<span class="strong"><strong><li class="one"><a href="#">1 Star</a></li></strong></span>
<span class="strong"><strong><li class="two"><a href="#">2 Stars</a></li></strong></span>
<span class="strong"><strong><li class="three"><a href="#">3 Stars</a></li></strong></span>
<span class="strong"><strong><li class="four"><a href="#">4 Stars</a></li></strong></span>
<span class="strong"><strong><li class="five"><a href="#">5 Stars</a></li></strong></span>
</ul>
.rating {
margin: 0;
padding: 0;
list-style: none;
clear: both;
width: 75px;
height: 15px;
background-image: url(stars.gif);
background-repeat: no-repeat;
position: relative;
}
.rating li {
text-indent: −9999em;
float: left; /* for IE6 */
}
.rating li a {
position: absolute;
top: 0;
left: 0;
z-index: 20;
height: 15px;
width: 15px;
display: block;
}
.rating .one a {
left: 0;
}
.rating .two a {
left: 15px;
}
.rating .three a {
left: 30px;
}
.rating .four a {
left: 45px;
}
.rating .five a {
left: 60px;
}