- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在网站上使用带有产品界面的 jQuery 价格范围 slider ,我找到了一些示例,但他们添加了 php,如何使用 c# 调用此 javascript?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" href="jquery-ui-1.8rc1.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8rc1.custom.min.js"></script>
<script type="text/javascript">
$(function() {
$slider = $("#slider");//Caching slider object
$amount = $("#amount");//Caching amount object
$slider.slider({
range: true, // necessary for creating a range slider
min: 0, // minimum range of slider
max: 500, //maximimum range of slider
values: [75, 300], //initial range of slider
slide: function(event, ui) { // This event is triggered on every mouse move during slide.
$amount.html('$' + ui.values[0] + ' - $' + ui.values[1]);//set value of amount span to current slider values
}
});
$amount.html('$' + $slider.slider("values", 0) + ' - $' + $slider.slider("values", 1));
});
</script>
<title></title>
<style type="text/css">
body{font-size: 12px;font-family:"Arial","Helvetica","Verdana","sans-serif";}
.left{float:left;}
.clear{clear:both}
#wrapper{margin:40px auto;width:940px}
#leftSlider{width: 200px;margin-right: 30px;}
#range{margin-bottom: 20px;}
#products{width:710px}
#products ul{
list-style: none;
margin:0px;padding:0px
}
#products ul li{
margin:4px;
float:left;
height:180px;
width:200px;
background-color: #333;
-moz-border-radius:6px;
-webkit-border-radius:6px;
-khtml-border-radius:6px;
}
#amount{font-size: 14px; text-shadow:0px 1px 0px #ccc}
</style>
</head>
<body>
<div id="wrapper">
<div class="left" id="leftSlider">
<div id="range">Price Range <span id="amount"></span></div>
<div id="slider"></div>
</div>
<div class="left" id="products">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
</body>
</html>
最佳答案
public static void RegisterStartupScript(
Control control,
Type type,
string key,
string script,
bool addScriptTags
)
control Type: System.Web.UI.Control The control that is registering the client script block.
type Type: System.Type The type of the client script block. This parameter is usually specified by using the typeof operator (C#) or the GetType operator (Visual Basic) to retrieve the type of the control that is registering the script.
key Type: System.String A unique identifier for the script block.
script Type: System.String The script.
addScriptTags Type: System.Boolean true to enclose the script block with and tags; otherwise, false.
这将在客户端生成一个脚本 block 。
关于c# - 我如何从 C# 调用 javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6188244/
我是一名优秀的程序员,十分优秀!