标签: href

从<a>标签获取href值

我有以下html:

<div class="threeimages" id="txtCss">  
<a>   
       <img alt="Australia" src="/Images/Services%20button_tcm7-9688.gif"/>
</a>        
    <div class="text" id="txtLink">            
        <h2>
            <a href="/partnerzone/downloadarea/school-information/australia/index.aspx">Australia</a>
        </h2>            
        <p>Land of the sunshine!</p>        
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

现在,如果你看到div ID"txtLink"中有href,即澳大利亚

我想在页面的运行时将相同的href值复制到div ID"txtCss"的上面标签中,我的意思是当我的页面显示时我的html将如下所示:

<div class="threeimages" id="txtCss">  
<a href="/partnerzone/downloadarea/school-information/australia/index.aspx">   
       <img alt="Australia" src="/Images/Services%20button_tcm7-9688.gif"/>
</a>        
    <div class="text" id="txtLink">            
        <h2>
            <a href="/partnerzone/downloadarea/school-information/australia/index.aspx">Australia</a>
        </h2>            
        <p>Land of the sunshine!</p>        
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

请为上述问题提出一些代码

html javascript href

10
推荐指数
2
解决办法
10万
查看次数

如何写入'mailto'正文链接到当前页面

我的mailto网站的所有页面都有按钮,我想在电子邮件正文中写入该页面的引用.

在一个页面我可以

<a class="email" title="Email a friend" href="mailto:?subject=Interesting%20information&amp;body=I thought you might find this information interesting:%20%0d%0ahttp://www.a.com/Home/SiteMap/tabid/589/Default.aspx">Email</a>
Run Code Online (Sandbox Code Playgroud)

但是,我怎样才能为所有页面制作这个通用名称?

html javascript href

10
推荐指数
2
解决办法
7万
查看次数

rails 3 link_to与嵌套的content_tag一起创建<带有嵌套span的href - 如何?

嗨,我有一个noob问题,我想创建以下HTML结果:

<a href="/controller/action" class="button-big layer">TEXT<span class="arrow-big"></span></a>
Run Code Online (Sandbox Code Playgroud)

在上面的HTML中,我希望通过css将带有span-class的文本设置为图像样式.

当我尝试以下实现时,结果只反映了所需实现的一部分:

<%= link_to "TEXT", controller_path, :class => "button-big layer" %>
Run Code Online (Sandbox Code Playgroud)

结果是:

<a href="/controller/action" class="button-big layer">TEXT</a>
Run Code Online (Sandbox Code Playgroud)

<%= link_to(content_tag(:span, "", :class => "arrow-big"), controller_path, :class => "button-big layer") %>
Run Code Online (Sandbox Code Playgroud)

结果是:

<a href="/controller/action" class="button-big layer"><span class="arrow-big"></span></a>
Run Code Online (Sandbox Code Playgroud)

有谁知道怎么做?

href link-to ruby-on-rails-3 content-tag

10
推荐指数
2
解决办法
2万
查看次数

如何在两个HTML页面之间交换变量?

我有两个HTML页面,example1.htmlexample2.html.

如何将变量传递example1.htmlexample2.html使用查询字符串,并在example2.html不使用任何服务器端代码的情况下检索该变量?

html javascript href query-string

9
推荐指数
2
解决办法
5万
查看次数

'url','src'和'href'之间的差异

可能重复:
SRC和HREF之间的差异

在编写html/css时,似乎所有这些都完全相同.显然情况并非如此,如果你'href'什么时候应该'src',那你的时间会很糟糕.但我的问题是,是否有一种简单的方法可以记住哪些用途,以及何时使用它们?

html css url href src

9
推荐指数
2
解决办法
3万
查看次数

从jquery中的href获取参数值

脚本

 <a href="#?cat=MT&typ=1" data-reveal-id="reveal_popup" onclick="pop();" data-closeonbackgroundclick="false" data-dismissmodalclass="close-reveal-modal">due today</a>
 <a href="#?cat=MT&typ=2" data-reveal-id="reveal_popup" onclick="pop();" data-closeonbackgroundclick="false" data-dismissmodalclass="close-reveal-modal">due in 2 days</a>

 <div id="reveal_popup" class="reveal-modal">
 <div id="popup"></div>
 <a class="close-reveal-modal">&#215;</a>
 </div>

function pop() {

 var cat=**value of cat parameter in href**
 var type=**value of typ parameter in href**

 $.ajax({
       type:'post',
       url:site_url()+'/event/deleteEventSingle',
       data:{'cat':cat,'type':typ},
        async:false,
         success:function(result){}
        });
}
Run Code Online (Sandbox Code Playgroud)

在此用户单击href时,会出现具有不同数据的相同弹出窗口.实际上有超过10个hrefs,我试图在弹出窗口中显示用户输入数据的日历.这取决于两个参数cat和typ,如href所示.

需求

每个href都有自己的cat和typ值.单击href时,我希望使用jquery获取所点击的href的cat和typ值,以便我可以在ajax中传递这些变量.

var cat=**value of cat parameter in href**
var type=**value of typ parameter in href**
Run Code Online (Sandbox Code Playgroud)

试着

如何从click事件对象获取链接的href属性的参数

jquery href

9
推荐指数
2
解决办法
4万
查看次数

Window.location.href将参数发布到actionresult asp.net mvc

我尝试将文本框值发布到asp.net mvc中的actionresult

使用Javascript:

function OnButtonClick() {
    var data= {
        TextBox: TextBox.GetValue()
    };
    var PostData= data.TextBox;

    window.location.href = "Home/MyActionResult?Page=data" + PostData;
}
Run Code Online (Sandbox Code Playgroud)

的ActionResult

public ActionResult MyActionResult(string PostData)
{
    return view();
}
Run Code Online (Sandbox Code Playgroud)

每当我发布数据时Home/MyACtionResult,PostData始终是null,

我错过了什么?

如何将文本框值发布到actionresult?

javascript windows asp.net-mvc location href

9
推荐指数
1
解决办法
5万
查看次数

闪亮的仪表板:通过单击infoBox跳转到应用程序中的特定元素

在我的闪亮应用程序中,我想添加一个选项,让用户tab通过点击infoBox(或我想要的任何其他对象)跳转到应用程序中的特定元素(表格,情节,任何具有id的内容),当前或不同).

我的解决方案是围绕infoBoxdiv并添加href=#id_of_element属性.不幸的是,这个解决方案只适用tabs于额外的"data-toggle" = "tab"属性(它也不会改变打开tabactive),但这不是我想要的.

我的问题是:如何添加上述选项以及为什么此解决方案不起作用?这是我想要做的一个小例子:

UI

library(shiny)
library(shinydashboard)

shinyUI(
  dashboardPage(
    skin = "blue",
     dashboardHeader(title = "Example"),
    dashboardSidebar(
      sidebarMenu(id = "sidebarmenu",
              menuItem("Tab1", icon = icon("line-chart"),
                       menuSubItem("SubTab1", tabName = "sub1", icon = icon("bar-chart")),
                          menuSubItem("SubTab2", tabName = "sub2", icon = icon("database"))),
              menuItem("Tab2", tabName = "tab2", icon = icon("users"))
      )
    ),
    dashboardBody(
      tabItems(
       tabItem(tabName = "sub1",
          tags$div(href="#s2t2",
                   infoBox(value = "Go to table 2 in SubTab2 (not …
Run Code Online (Sandbox Code Playgroud)

html r href shiny shinydashboard

9
推荐指数
1
解决办法
699
查看次数

css文件链接html时如何正确写出本地文件的绝对路径?

我是 html/css 的初学者。

我使用 PHP 在不同的网页中包含相同的标题部分。head 部分有一个 href 链接,链接到外部 css。用于设置多个网页布局样式的文件。

由于不同的网页位于根文件夹中的不同子文件夹中,因此我必须使用绝对路径来链接css。文件,问题来了:我不知道如何正确编写它。

当我对每个单独的网页使用相对路径时,链接工作正常,但当我尝试使用绝对路径时,它根本不起作用。

我努力了:

1.href="文件:///C:\xampp\htdocs\root\styles\style.css"

2.href="文件:///C:/xampp/htdocs/root/styles/style.css"

3.href="文件://C:/xampp/htdocs/root/styles/style.css"

4.href="C:/xampp/htdocs/root/styles/style.css"

5.href="c:/xampp/htdocs/root/styles/style.css"

这是代码的开始部分:

<!DOCTYPE html>
<html lang="en">
  <head>
    <?php include('common/head.php') ?>
    <title>Home</title>
  </head>
Run Code Online (Sandbox Code Playgroud)

这是头部:

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="file:///C:\xampp\htdocs\root\styles\style.css">
Run Code Online (Sandbox Code Playgroud)

html css href absolute-path local-files

9
推荐指数
1
解决办法
1万
查看次数

如何在 Discord 网站上创建共享按钮?

我的意思是,就像一个 URL,用户可以单击该 URL 打开 Discord 应用程序或网站并预先编写一条 Discord 消息,准备发送。

我需要类似于mailto:链接的东西,我可以在其中将消息正文文本设置为参数或直接在 URL 中设置。

有这样的事情存在吗?任何帮助将非常感激。

href discord

9
推荐指数
1
解决办法
1855
查看次数