jquery 不继续到下一页
我有jquery,但它不会进入下一页,它总是显示图像并等待,从不进入下一页。
HTML 代码:
<div id="toHide" class="pb-text-align-center">
<img style="display: inline" src="img/load.gif" />
<form wicket:id="safeForm" class="clearfix">
<input type="hidden" wicket:id="submitted" value="false" />
</form>
</div>
HTML 视图源:
<SCRIPT type="text/javascript">
var $ = jQuery.noConflict();
$('.toHide').show().doTimeout(100,function() {
$('.toHide').find('safeForma3').submit();});
</SCRIPT>
检票口代码:
static private class SafeSubmitBehaviour extends AbstractBehavior{
public void onRendered( Component component ) {
super.onRendered( component );
StringBuffer buffer = new StringBuffer(200);
buffer.append("<script type=\"text/javascript\" >\n");
buffer.append("var $ = jQuery.noConflict();\n ");
buffer.append(" $('.toHide').show().doTimeout(100,function() { $('.toHide').find('");
buffer.append(component.getMarkupId()).append("').submit();});\n</script>");
component.getResponse().write(buffer);
}
}
buffer.append(component.getMarkupId()).append("').submit();});\n</script>");
我尝试过:$('.toHide').find('form').submit();});。但还是没有用。
将 $('.toHide') 更改为 $('#toHide') 后,页面将转到下一页,但动画在 IE6/7 中没有发生,在 FF 中工作正常。
i have jquery, but it is not going to next page, it always display images and waits, never proceed to next page.
HTML code:
<div id="toHide" class="pb-text-align-center">
<img style="display: inline" src="img/load.gif" />
<form wicket:id="safeForm" class="clearfix">
<input type="hidden" wicket:id="submitted" value="false" />
</form>
</div>
HTML view source:
<SCRIPT type="text/javascript">
var $ = jQuery.noConflict();
$('.toHide').show().doTimeout(100,function() {
$('.toHide').find('safeForma3').submit();});
</SCRIPT>
wicket code:
static private class SafeSubmitBehaviour extends AbstractBehavior{
public void onRendered( Component component ) {
super.onRendered( component );
StringBuffer buffer = new StringBuffer(200);
buffer.append("<script type=\"text/javascript\" >\n");
buffer.append("var $ = jQuery.noConflict();\n ");
buffer.append(" $('.toHide').show().doTimeout(100,function() { $('.toHide').find('");
buffer.append(component.getMarkupId()).append("').submit();});\n</script>");
component.getResponse().write(buffer);
}
}
buffer.append(component.getMarkupId()).append("').submit();});\n</script>");
i have tried with: $('.toHide').find('form').submit();});. But still no use.
After chaging $('.toHide') to $('#toHide'), page is going ot next page, but animation is not happening in IE6/7, it works fine in FF.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
“toHide”
具有该字符串,因为它是 id 值,而不是它的类,因此您需要:
选择器“.toHide”查找带有“的元素” toHide”作为类的一部分,这样就根本找不到您的
。
要查找表格,您可以使用
The "toHide"
<div>
has that string as it's id value, not it's class, so you need:The selector ".toHide" looks for an element with "toHide" as part of the class, so that wouldn't find your
<div>
at all.To find the form, you'd use
我认为你应该尝试这个:
或者,如果表单上有一个 ID(我不熟悉 Wicket),你可以使用:
ID 选择器使用“#”字符,而不是“.”,这是类选择器前缀。
I think you should try this:
Or if the form has an ID on it (I'm not familiar with Wicket) you can just use:
The ID selector uses a '#' charactor, not a '.', which is the class selector prefix.
HTML 中没有名为“safeForm15”的 id,这正是 setTimeout 尝试选择的 ID。事实上,该表单具有 ID 命名空间,我认为这从一开始就是非法的。
无论如何,快速解决方法是取消“toHide”,并删除 component.getMarkupId 位。
补充:
您需要将其更改
为:
There is no id named 'safeForm15' in your HTML, which is what your setTimeout is trying to select. In fact, the form has ID namespaced, which I believe is illegal to begin with.
Regardless, the quick fix is to cue off of 'toHide', and get rid of the component.getMarkupId bit.
Added:
You need to change this:
to this:
这是 IE 的问题,如果您有一个不可见的 GIF,然后将其设置为可见,则动画不起作用。
最好的办法就是使用一个空图像标签,例如
,然后当您希望它可见时将
src
设置为正确的路径即。
如果你这样做的话应该会起作用。
编辑
你可以这样做:
html代码:
尝试一下,但可能需要一些摆弄。
This is a problem with IE, if you have a GIF that is not visible and then set it to visible the animation doesn't work.
Best thing to do is just used an empty image tag like this
<img src='' />
and then when you want it to become visible set thesrc
to the correct path i.e.<img src='AnimatingImg.gif' />
.It should work if you do it this way.
EDIT
You can do it like this:
html code:
Try that, might want a bit of fiddling though.
其他人提到了您的选择器的问题。
但是,此代码也赤裸裸地出现在两个
script
标记之间。这意味着它们一被解析就会被执行。这意味着它们可以在整个 DOM 加载之前执行,从而使它们无效。你需要使用这样的东西:
Others have mentioned the problem with your selector.
However, this code also appears naked between two
script
tags. This means that they will be executed as soon as they are parsed. This means that they could be executed before the whole DOM is loaded, rendering them ineffective.You need to use something like this: