【问题标题】:Link to another part of a different html page in web.py链接到 web.py 中不同 html 页面的另一部分
【发布时间】:2013-09-01 08:19:27
【问题描述】:

我有两个 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>

【问题讨论】:

    标签: jquery url web.py


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-28
      • 1970-01-01
      • 2021-02-09
      • 2012-08-14
      • 1970-01-01
      相关资源
      最近更新 更多