我有两个HTML页面,example1.html和example2.html.
如何将变量传递example1.html给example2.html使用查询字符串,并在example2.html不使用任何服务器端代码的情况下检索该变量?
我有不同的锚标签与href = #ids,我需要使用一般css规则隐藏它们,所有这些,
Content xxxxxxxxx <a href="#tab1">Table 1</a>.Content xxxxxxxxxxxx <a href="#tab2">Table 2</a>
Run Code Online (Sandbox Code Playgroud)
我试图使用这样的东西:
#wrap a='#tab1'{
display:none;
}
Run Code Online (Sandbox Code Playgroud)
知道怎么做吗?
我有一个链接加载页面并在点击时调用javascript函数.问题是在页面重定向之前javascript函数无法完成.反正有没有确保它呢?
您会注意到alert()javascript函数中有一个被注释掉的内容,如果我取消注释它,该函数就能完成.但是,我显然不希望实际发生警报弹出窗口.
链接在这里 :
<a href="p.php?p=$randString&s=$postCat" onclick="setYSession();">
Run Code Online (Sandbox Code Playgroud)
这是无法及时完成的javascript函数:
function setYSession() {
var YposValue = window.pageYOffset;
$.get('yPosSession.php?yValue=' + YposValue);
//alert(YposValue);
return false;
}
Run Code Online (Sandbox Code Playgroud) 我有带视频和音频文件的html文件.我想使用标签href链接文件,如mp3或mp4并下载该文件.我的视频和音频文件与我的html文件存储在同一个文件夹中.
我试过这段代码:
<a href="music/hermin.mp3" target="_blank">download</a>
Run Code Online (Sandbox Code Playgroud)
但是没有下载我的文件,只需在中心打开一个带有播放暂停控件的新选项卡.
从这个问题我得到添加"下载"到我的href标签,但它是为现代浏览器.旧浏览器怎么样?
我如何在html文件中为我的视频/音频创建下载链接并支持所有浏览器(不仅适用于现代浏览器)?
提前谢谢,抱歉我的英语不好.
我正在尝试使用绝对URL而不是#锚链接使用scrollspy.
例如,我可以通过仅使用来轻松运行scrollspy <a href="#section1"></a>
我希望能够通过使用运行scrollspy <a href="http://myurl.com/#section1"></a>
这样做的原因是,主页上的主要导航是scorllspy,但博客不是主页的一部分.访问博客然后单击主页上的某个链接时,您将被路由到http://myurl.com/blog/#section1而不是主页ID.
我找到了这个解决方案(使用url和hash with bootstrap scrollspy),但无法使其完全正常运行.经过一些调整和大量的正则表达式组合后,我可以将它添加到第一个菜单项的活动类,但它不会刷新.
有什么想让这个工作?我应该使用替代的js库吗?
解决方案感谢特洛伊
jQuery(function($){
// local url of page (minus any hash, but including any potential query string)
var url = location.href.replace(/#.*/,'');
// Find all anchors
$('.nav-main').find('a[href]').each(function(i,a){
var $a = $(a);
var href = $a.attr('href');
// check is anchor href starts with page's URI
if (href.indexOf(url+'#') == 0) {
// remove URI from href
href = href.replace(url,'');
// update anchors HREF with new one …Run Code Online (Sandbox Code Playgroud) 我在这里检查了其他帖子,没有找到我正在寻找的结果.我想点击
<a href="#about">About</a>
<div id="about">Content of this..</div>
Run Code Online (Sandbox Code Playgroud)
并将其滚动到该元素,而不将www.domain.com/#about放在地址栏中
作为一个完美的例子,请查看我在这里找到的这个网站并点击一些链接 - 点击时不要更改地址栏.
我正在尝试编写分页代码.一个功能是禁用当前链接,使其看起来像文本并且不可点击.在html页面中,这可以通过省略href属性来实现,如:
<a>Link</a>
Run Code Online (Sandbox Code Playgroud)
我不能在javaScript中这样做,
AvdonPagination.prototype.manageLinks = function(link){
if(link){
this.current.href = '#';
this.current = link;
}else{
this.current = this.links[0];
}
this.current.href = null;
}
Run Code Online (Sandbox Code Playgroud)
因为
this.current.href = null;
Run Code Online (Sandbox Code Playgroud)
产生
<a href="null">Link</a>
Run Code Online (Sandbox Code Playgroud)
我也试过了this.current.href="",this.current.disabled=true但是它们都不起作用.我怎么能实现<a>Link</a>?
我有一个看起来像这样的链接:
<a class="link" href="https://www.google.com/?q=">Hello world</a>
Run Code Online (Sandbox Code Playgroud)
是否有可能将其呈现为Hello World?
该链接应指向https://www.google.com/?q=Hello world,而不在href中指定此链接.
我在想javascript可能是最好的方法吗?
任何帮助都会很好!
<button class="button button-outline button-positive">
<a href="www.google.com">fes</a>
</button>
Run Code Online (Sandbox Code Playgroud)
如果我使用ng-click,它的工作正常,但我需要href.
基本上我正在寻找 Instagram 的等价物:
whatsapp://send?text=myspecifiedurlgoeshere.com
我在网上找不到任何关于此的信息。我在 facebook、facebook messenger、twitter、whatsapp 和 email 上这样做没有问题
href ×10
html ×6
javascript ×4
anchor ×2
address-bar ×1
audio ×1
browser ×1
css ×1
function ×1
hide ×1
http ×1
hyperlink ×1
instagram ×1
onclick ×1
query-string ×1
scrollspy ×1
social-media ×1
video ×1