gpt4 book ai didi

jquery - 如何在 "X"秒后调用 jquery 函数

转载 作者:行者123 更新时间:2023-12-03 21:33:54 25 4
gpt4 key购买 nike

我有一个 jquery 函数,我需要在 Iframe 中打开网站后调用它。

我正在尝试在 Iframe 中打开一个网络链接,打开它后我需要调用以下函数。那么我该怎么做呢?

这是我的功能:

<script type="text/javascript">
$(document).ready(function(){
$("#<%=Button1.ClientID%>").click(function (event) {

$('#<%=TextBox1.ClientID%>').change(function () {
$('#various3').attr('href', $(this).val());
});
$("#<%=Button2.ClientID%>").click();
});
})
function showStickySuccessToast() {
$().toastmessage('showToast', {
text: 'Finished Processing!',
sticky: false,
position: 'middle-center',
type: 'success',
closeText: '',
close: function () {

}
});
}

</script>

这是我在 IFrame 中打开链接的按钮:

<a id="various3" href="#"><asp:Button ID="Button1" 
runat="server" Text="Button" OnClientClick="Button2_Click"/></a>

实际上这是我拥有的简单页面:

enter image description here

这就是消息 enter image description here

最佳答案

您可以在 JavaScript 中使用普通的 setTimeout 方法。

即...

setTimeout( function(){ 
// Do something after 1 second
} , 1000 );

在您的示例中,您可能希望直接使用 showStickySuccessToast

关于jquery - 如何在 "X"秒后调用 jquery 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8216394/

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