gpt4 book ai didi

php - 当 ajax 开始在后台运行时显示加载图像

转载 作者:行者123 更新时间:2023-12-02 18:57:53 24 4
gpt4 key购买 nike

我有以下脚本,当我单击录制按钮时该脚本开始运行。我想在单击“记录”按钮时显示一张图像,该图像与我们在...上上传图像时通常显示的图像相同。这是脚本:

<script>
function st()
{
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert('RECORDING Start');
}

}
xmlhttp.open('GET','http://localhost/IPCAM/start.php;)

xmlhttp.send();

setTimeout('st()',5000);
}
</script>

当我点击这个按钮时,ajax 就会启动背景。

<button OnClick="st()">Record</button>

我不知道该怎么做,请有人帮助我。

最佳答案

首先,我发现你的问题很不清楚,但让我尝试一下:

确保您有一个定义图像的 css 类:

.recordingBackground
{
background-image: url("record.png");
}

(或者只使用 JavaScript)

创建按钮:

<input type="button" id="recordButton" value="Record" />

让 jQuery 监听按钮,您可以将类添加到元素中:

$('#recordButton').live("click", function()
{
$('#background').addClass('recordingBackground');
// Or use a similar method (for example: pure javascript).
// #background is just an example div.
});

关于php - 当 ajax 开始在后台运行时显示加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15145751/

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