0

我有两个 html 页面:curpage.html and nextpage.html 如果我想将某人正常重定向到 nextpage.html 页面的中间,你会这样做

<a href =  "/nextpage.html#somediv> link </a>

nextpage.html 在哪里

<body>
a bunch of html
<div id="somediv">
more blurbs

但是,我使用的是 web.py,它以完全不同的方式重定向。因此,我创建了一个如下所示的链接:

<a href = "./nextpage?linkLocation=somediv">

在我的主 web.py 文件中:

urls = (

    '/nextpage', Instructional
 )

....
further down
.....
class Instructional(object):
def GET(self):
    data=  web.input()
    return render.instructional(data.linkLocation)

现在我只需要使用 scrollTop 添加一些 jQuery,但我无法将 data.linkLocation 转换为变量。我的问题是:有没有更简单的重定向方法?!或者我如何将 linkLocation 变成一个变量?


下一页:

$def with (linkLocation)
$var location:  $linkLocation
$var content_type: text/html
<script type="text/javascript">

var a = location
a.toString() not working
//var location = jQuery("#shortform").offset();

//var off = location.offset(); not working

//jQuery.scrollTop(offset.top); not working

</script>
4

1 回答 1

0

您实际上不需要传递linkLocation=somediv给 web.py 以在页面内重定向,只需使用以下链接<a href="/nextpage#somediv>link</a>

于 2013-10-08T11:53:53.400 回答