我有两个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)
现在,我只需要使用jQuery添加一些scrollTop,但是将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>
发布于 2013-10-08 11:53:53
您实际上不需要将linkLocation=somediv
传递给web.py以便在页面内重定向,只需使用下面的链接<a href="/nextpage#somediv>link</a>
https://stackoverflow.com/questions/18501796
复制相似问题