Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在特定列加载html表_Html_Css_Html Table_Anchor - Fatal编程技术网

在特定列加载html表

在特定列加载html表,html,css,html-table,anchor,Html,Css,Html Table,Anchor,我试图在页面加载时让我的html表在特定列上加载,我甚至不知道从哪里开始 我已将其上传到此处以查看演示: 我在我的身体标签上试过: onload=' location.href="#right_column" ' 并将id='right\u column'添加到正确的td中,但这不起作用 尝试将其加载到标记为“this one”的单元格中如果我认为您希望在页面加载时滚动到特定列,最简单的方法是使用库,例如jQuery: $('.inner').stop().animate({ scro

我试图在页面加载时让我的html表在特定列上加载,我甚至不知道从哪里开始

我已将其上传到此处以查看演示:

我在我的身体标签上试过:

onload=' location.href="#right_column" '
并将
id='right\u column'
添加到正确的
td
中,但这不起作用


尝试将其加载到标记为“this one”的单元格中

如果我认为您希望在页面加载时滚动到特定列,最简单的方法是使用库,例如jQuery:

$('.inner').stop().animate({
    scrollLeft: $('#right_column').offset().left
}, 1000);

您试图使其以与使用锚定类似的方式工作,但这对于水平对齐的内容是不可能的。

这里有一个包含标题宽度的提琴: 同样,jquery解决方案,本质上与上面相同,但需要减去标题宽度才能找到正确的位置。请参阅小提琴以了解添加id的位置

 $(document).ready(function(){
    var hw = $('#headerWidth').width();
    var f = $('#scrollToMe').position().left - hw;
    $('.inner').scrollLeft(f);
})

可能是因为您正试图在提到的td(这一个)中加载一些html代码(如表),正如您提到的将id=right\u列添加到此td,然后使用下面的jquery逻辑-

var newtable = '<table class="newtable">New table, this may be from ajax call also</table>'
$('#right_column').html(newtable);
var newtable='新表,这也可能来自ajax调用'
$(“#右#列”).html(新表);

小提琴中没有
body
元素,因此也没有
onload
属性。无论如何,您应该使用
location.hash=“#right_column”