IE9 表具有随机行,这些行在随机列处偏移 [英] IE9 table has random rows which are offset at random columns

查看:15
本文介绍了IE9 表具有随机行,这些行在随机列处偏移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类别页面,当用户单击一个类别时,该类别下的项目通过 jQuery Ajax 调用加载到表格中,并粘贴到类别下方的元素中.然而,似乎发生的情况是,加载表中的一两行将在随机列中具有其数据偏移量.我已经在 IE9、FF 3.6 和 Chrome 13 中测试过这个.这似乎只发生在 IE9 中.表格数据格式完美 - 我使用 Fiddler 拦截请求,然后查看原始 html,没有任何问题.

I have a page of categories, when the user clicks one, the items under that category are loaded via a jQuery Ajax call, in a table, and stuck into an element just below the category. What seems to happen though, is that one or two rows in the loaded table, will have its data offset at a random column. I have tested this in IE9, FF 3.6, and Chrome 13. This ONLY seems to happen in IE9. The tabular data is perfectly formatted - I have used Fiddler to intercept the requests and then looked at the raw html, and there's nothing wrong with it.

该站点是在 ASP.NET MVC3 中构建的.通过 Ajax 请求返回的表返回 Razor 部分视图.不幸的是,这必须在 IE 中工作.我真的希望有人对此做出解释.

The site was built in ASP.NET MVC3. The table that is returned via the Ajax request returns a Razor partial view. This has to work in IE, unfortunately. I'm really hoping someone has an explanation for this.

这是一个例子:还有一个:

Here's one example: And another:

编辑 [2012/03/25]:这个应用程序已经离开我的手,所以我无法验证哪些答案有效.Adam Youngers 发布到 http 的链接://social.msdn.microsoft.com/Forums/pl/iewebdevelopment/thread/e6f49d52-ec3f-47c5-802e-b80d1a58ed39 似乎有一些可能的解决方案.根据过去的经验,我会先尝试这些选项..

EDIT [2012/03/25]: This application has left my hands, so I am unable to verify which of the answers work. The link that Adam Youngers posted to http://social.msdn.microsoft.com/Forums/pl/iewebdevelopment/thread/e6f49d52-ec3f-47c5-802e-b80d1a58ed39 seemed to have some possible solutions. From past experience, I would try these options first..

  1. 添加 到页面的头部元素.
  2. 尝试删除表格单元格之间的任何空白.例如.</td><td>",而不是让下一个单元格从新行开始.(这在过去给我造成了奇怪的间距问题)

推荐答案

问题似乎出在空白处.

我在 http://social.msdn.microsoft.com/Forums/en-AU/iewebdevelopment/thread/28d78780-c95c-4c35-9695-237ebb912d90

使用像这样的正则表达式替换您从 AJAX 调用中获得的 html.

Replace the html you get from the AJAX call using a regular expression like this.

var expr = new RegExp('>[ 	
vf]*<', 'g');
tableHtml = tableHtml.replace(expr, '><');

这篇关于IE9 表具有随机行,这些行在随机列处偏移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆