gpt4 book ai didi

asp.net - 在 asp.net 处理程序中添加 css

转载 作者:太空宇宙 更新时间:2023-11-04 05:08:09 25 4
gpt4 key购买 nike

我想知道是否可以将 css 添加到处理程序中的 .aspx 文件中的元素之一。

这是我的处理程序:

Private Sub UploadWholeFile(ByVal context As HttpContext, ByVal statuses As List(Of FilesStatus))
For i As Integer = 0 To context.Request.Files.Count - 1
Dim file = context.Request.Files(i)
file.SaveAs(ingestPath & Path.GetFileName(file.FileName))
Thread.Sleep(1000)
Dim fname = Path.GetFileName(file.FileName)
statuses.Add(New FilesStatus With {.thumbnail_url = "Thumbnail.ashx?f=" & fname, .url = "Upload.ashx?f=" & fname, .name = fname, .size = file.ContentLength, .type = "image/png", .delete_url = "Upload.ashx?f=" & fname, .delete_type = "DELETE", .progress = "1.0"})
Next i
End Sub

我有一个按钮,它实际上位于我的 default.aspx 页面的模板文件中,如下所示:

<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td><img src="img/paperclip.png"/></td>
<td class="imagename"><span>{%=file.name%}</span></td>
{% if (file.error) { %}
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else if (o.files.valid && !i) { %}

<td class="start" style="visibility:hidden">{% if (!o.options.autoUpload) { %}
<button class="btn btn-primary">
<i class="icon-upload icon-white"></i>
<span>{%=locale.fileupload.start%}</span>
</button>
{% } %}</td>
{% } else { %}
<td colspan="2"></td>
{% } %}
<td class="cancel">{% if (!i) { %}
<button class="btn btn-warning">
<i class="icon-ban-circle icon-white"></i>
</button>
{% } %}</td>
</tr>
{% } %}
</script>

现在我想将按钮更改为图像。那么我该如何从处理程序中做到这一点呢?

如果我点击下面的按钮,我需要更改 btn-warning

的图标
<button type="submit" class="btn btn-primary start">
<i class="icon-upload icon-white"></i>
<span>Start upload</span>
</button>

最佳答案

如果您将按钮更改为图像客户端,当用户单击它时会更容易。 (看起来这真的是你想要的)

<button class="btn btn-primary" onclick="changeToImage();">

function changeToImage()
{
$('.btn-warning').replaceWith('<img src="/wherever.jpg"/>');
}

Swap button for image (Jquery)

关于asp.net - 在 asp.net 处理程序中添加 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9958036/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com