你能写个asp.net mvc 弹窗代码例子吗
时间: 2023-06-03 13:03:52 浏览: 68
当然可以,以下是一个基本的ASP.NET MVC弹窗代码示例:
1. 在你的View页面中,添加以下代码:
```html
<button id="popupButton">点击打开弹窗</button>
<div id="popupContent" style="display:none">
这里是弹窗内容
</div>
```
2. 在同一页面中,添加以下Javascript代码:
```javascript
$(document).ready(function () {
$('#popupButton').click(function () {
$('#popupContent').dialog({
modal: true,
title: '弹窗标题',
width: 400,
height: 300,
buttons: {
"关闭": function () {
$(this).dialog("close");
}
}
});
});
});
```
3. 添中相应的Jquery和Jquery UI库文件:
```html
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
```
这样就完成了一个基本的ASP.NET MVC弹窗代码示例。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)