如何在“X”之后调用jquery函数秒 [英] How to make a jquery function call after "X" seconds
问题描述
我试图在iframe中打开一个web链接,并在打开网页之后打开它。
我有一个jquery函数,我需要在打开iframe中的网站后调用它。我需要调用下面的函数。
所以我该怎么做?
以下是我的函数:
< script type =text / javascript>
$(document).ready(function(){
$(#<%= Button1.ClientID%>)。click(function(event){
$ b $ $('#<%= TextBox1.ClientID%>')。change(function(){
$('#various3')。attr('href',$(this).val() );
});
$(#<%= Button2.ClientID%>)。click();
});
})
函数showStickySuccessToast(){
$()。toastmessage('showToast',{
text:'Finished Processing!',
sticky:false,
position:'middle-中心',
类型:'成功',
closeText:'',
close:function(){
});
}
< / script>
这是我在IFrame中打开链接的按钮:
< a id =various3href =#>< asp:Button ID =Button1
runat =serverText =按钮OnClientClick =Button2_Click/>< / a>
实际上,这是我正在使用的简单网页:
这是消息
您可以在JavaScript中使用正常的setTimeout方法。
ie ...
setTimeout(function(){
//在1秒后做某事
},1000);
在您的示例中,您可能需要使用 I have a jquery function and I need to call it after opening the website in an Iframe. I am trying to open a weblink in an Iframe and after opening it I need to call the below function.
So how do I do that? Here is my function: This is my button to open the link in an IFrame: Actually this is the simple Page I'm having: And this is the message
You can just use the normal setTimeout method in JavaScript. ie... In your example, you might want to use 这篇关于如何在“X”之后调用jquery函数秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! showStickySuccessToast $ c $直接。
<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>
<a id="various3" href="#"><asp:Button ID="Button1"
runat="server" Text="Button" OnClientClick="Button2_Click"/></a>
setTimeout( function(){
// Do something after 1 second
} , 1000 );
showStickySuccessToast
directly.