- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 Google Apps 脚本创建了一个简单的 Html 文件并将其部署为网络应用程序。虽然我在同一页面上添加了指向某些元素的链接,但它不会跳转到指定的元素并返回空白页面。
这是 html 的片段。
<ul>
<li><a href ="#april">April</a></li>
<li><a href ="#may">May</a></li>
<li><a href ="#june">June</a></li>
</ul>
.
.
.
<a id="april">2019/04</a>
.
.
.
<a id="may">2019/05</a>
.
.
.
<a id="june">2019/06</a>
.
.
.
当我点击这些元素时,它会重定向到另一个像这样的 URL。
https://{scriptid}-script.googleusercontent.com/userCodeAppPanel#id
我尝试访问 {url}+{#id},它给了我相同的页面。所以 id 属性似乎不起作用,但我不知道要修复什么。我在这里做错了什么?
编辑到目前为止,这是我尝试过的。 https://script.google.com/macros/s/AKfycbyW5FRfQP3CpOU0brJEeeSgR6xypQ57jAjDs5KfQFYRmYIaaBs/exec
gs文件
function doGet() {
return HtmlService.createTemplateFromFile('index').evaluate();
}
html文件
<!DOCTYPE html>
<html>
<head>
<base target="_top">
1
<br>
2
<br>
3
<br>
4
<br>
5
<br>
<a name="top">Top</a>
</head>
<body>
<br><br><br><br><br>
<a href="#top">Goto Top(blank page)</a>
<br>
<a href="https://script.google.com/macros/s/AKfycbyW5FRfQP3CpOU0brJEeeSgR6xypQ57jAjDs5KfQFYRmYIaaBs/exec#top">Goto Top(just reload)</a>
</body>
</html>
最佳答案
以下函数在 Google 应用程序脚本网络应用程序中对我来说工作正常。尝试将 base 设置为 _self
或留空:
<!DOCTYPE html>
<html lang="en">
<head>
<base />
<meta charset="UTF-8" />
<title>#top Demo</title>
</head>
<body>
<div>
<ul id="navigation">
<li>
<a href="#bottom">Click here to go to the bottom</a>
Lorum ipsum1
</li>
<li>
<a href="#middle">Click here to go to the middle</a>
Lorum ipsum2
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum3
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum4
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum5
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum6
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum7
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum8
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum9
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum10
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum11
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum12
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum13
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum14
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum15
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum16
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum17
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum18
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum19
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum20
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum21
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum22
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum23
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum24
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum25
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum26
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum27
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum28
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum29
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum30
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum31
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum32
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum33
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum34
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum35
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum36
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum37
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum38
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum39
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum40
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum41
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum42
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum43
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum44
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum45
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum46
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum47
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum48
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum49
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum50
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum51
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum52
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum53
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum54
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum55
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum56
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum57
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum58
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum59
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum60
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum61
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum62
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum63
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum64
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum65
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum66
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum67
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum68
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum69
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum70
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum71
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum72
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum73
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum74
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum75
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum76
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum77
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum78
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum79
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum80
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum81
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum82
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum83
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum84
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum85
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum86
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum87
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum88
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum89
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum90
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum91
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum92
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum93
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum94
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum95
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum96
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum97
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum98
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum99
</li>
<li>
<a id="middle" href="#top">Click here to go top</a>
Lorum ipsum100
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum101
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum102
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum103
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum104
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum105
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum106
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum107
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum108
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum109
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum110
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum111
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum112
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum113
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum114
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum115
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum116
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum117
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum118
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum119
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum120
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum121
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum122
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum123
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum124
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum125
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum126
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum127
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum128
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum129
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum130
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum131
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum132
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum133
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum134
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum135
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum136
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum137
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum138
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum139
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum140
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum141
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum142
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum143
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum144
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum145
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum146
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum147
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum148
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum149
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum150
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum151
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum152
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum153
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum154
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum155
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum156
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum157
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum158
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum159
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum160
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum161
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum162
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum163
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum164
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum165
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum166
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum167
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum168
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum169
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum170
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum171
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum172
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum173
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum174
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum175
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum176
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum177
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum178
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum179
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum180
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum181
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum182
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum183
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum184
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum185
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum186
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum187
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum188
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum189
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum190
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum191
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum192
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum193
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum194
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum195
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum196
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum197
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum198
</li>
<li>
<a href="#top">Click here to go top</a>
Lorum ipsum199
</li>
<li>
<a id="bottom" href="#top">Click here to go top</a>
Lorum ipsum200
</li>
</ul>
</div>
</body>
</html>
关于html - 跳转到 GAS html 中的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57584722/
我有两个函数,在 C++ 中看起来像这样: void f1(...); void f2(...); 我可以更改 f1 的主体,但是 f2 是在另一个我无法更改的库中定义的。我绝对必须(尾部)在f1 中
我正在尝试避免这个 while 循环出了什么问题 while True: start = input("Ok, are you ready now?\n") if (start !=
当我点击按钮加载页面时,它加载正常。调整浏览器大小后,此页面会不断刷新。我复制了布局页面的一部分,用于处理按钮。如果我遗漏了什么,你能告诉我吗? Statistics 最佳答案 确保没有在“调
PHP的header函数 可以很少代码就能实现HTML代码中META 标签 这里只说用 header函数来做页面的跳转 1. HTML代码中页面的跳转的代码 HTML meta refresh 刷
我使用并喜欢 Tim Pope's excellent Fugitive plugin for VIM ,我一直希望能够加载 :Glog quickfix 中所有文件的差异,并通过它们循环到 HEAD
当我访问 my_site.com/page.php#something 时,滚动位置是携带此特定主题标签的元素之一,而不是页面顶部。 执行 window.scrollTo(0, 0); 不会改变这一事
在我自己的一个应用程序中看到这一点后,我构建了一个测试应用程序。 我在导航 Controller 中嵌入了一个集合 View 。 这一切都链接到 ViewController 类。 class Vie
在我们的应用程序中,当其中一个 View 被推送到导航 Controller 时,导航栏会显示 5 秒,然后我们将 navigationBarHidden 设置为 TRUE。稍后,如果用户点击屏幕,我
我必须更新滚动 UITextView 中的少量文本。我只会在光标当前所在的位置插入一个字符,并且只需按一下导航栏上的按钮即可执行此操作。 我的问题是,每当我调用 TextView 的setText方法
我正在使用第三方脚本(详细信息如下)将表单分解为多个 ajax 页面。当我单击前进到下一页时,它会跳转到表单顶部的 anchor 。这是一种不必要且不和谐的行为,我想阻止它发生。这个脚本不是我写的,不
这个问题已经有答案了: Call an absolute pointer in x86 machine code (2 个回答) 已关闭 4 年前。 我正在用 C 语言为 x86_64 linux 编
查看objdump -d ELFfile的输出,我无法区分直接和间接跳转/调用。有什么建议吗? 最佳答案 间接调用和跳转有*在指令之后和位置之前,如callq *%r13和jmpq *0x204d8a
我试图通过单击 anchor 链接来突出显示 div。我的意思是如果我点击My link 然后滚动到 here在此页面上,我有很多 anchor 链接和 div,因此很难识别哪个 div 然后滚动,因
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 8 年前。 Improve this ques
没有任何编程经验,只有基本的 html/css。我正在尝试创建一个 javascript 菜单(如果有更简单的方法,可以接受建议吗?),它将根据第一个菜单中选择的选项显示/隐藏?我有以下... Q
我正在使用 jquery 的 scrollTop 函数,但无法弄清楚为什么在同一项目上多次调用时它会跳来跳去。 我把这个 example 放在一起了来说明问题。单击测试按钮时,它会交替滚动到指定的项目
我已经创建了一个关于 Storyboard的项目, Storyboard上有两个名为“loginViewController”、“BViewController”的 View Controller ,
基本上,我在网站的最顶部有一个我想隐藏的 div,当您单击一个按钮时,它会将整个网站向下推并显示其内容。与此非常相似 nd.edu (单击标题右侧的帮助中心或白杨站点)。我正在使用 jquery 来完
当我单击所单击的 div 旁边的 div 框时,我的底部 div 会上下跳跃 这是 fiddle 的链接 http://jsfiddle.net/abtPH/17/ 这是我的jquery $('li
我在悬停时调整 .main-partners div 中卡片的大小,以便出现 查看更多 按钮。 我的问题是当我 :hover 在 .main-partners 中的卡片 (.main-card) 上时
我是一名优秀的程序员,十分优秀!