标签: href

使用href用参数调用javascript函数

我正试图从一个href调用javascript函数.该函数有一个参数,将由eval函数检索.但是会发生一些错误.

脚本:

function rate(id) {

            // do something
        }
Run Code Online (Sandbox Code Playgroud)

一个将调用该函数的标记:

<a href="javascript:rate(" + <%#Eval("ID")%> + ")" >rate</a>
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

javascript asp.net eval href

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

获取href值的内容

我需要使用正则表达式来捕获href的内容.例如,当我将规则应用于href ="www.google.com"时,我想获得www.google.com.另外,我想忽略所有只有#值的href.

现在,我正在玩一段时间,我想出了这个:

href=(?:\"|\')((?:[^#]|.#.|.#|#.)+)(?:\"|\')
Run Code Online (Sandbox Code Playgroud)

当我在http://www.rubular.com/中尝试它时,它就像一个魅力,但我需要在PHP中使用它与preg_replace_callback,并且我没有得到预期的结果(用于在PHP中测试它,我正在使用这个网站:http://www.pagecolumn.com/tool/pregtest.htm).

我的错在哪里?

php href

-1
推荐指数
1
解决办法
3208
查看次数

A href的HTML onclick不起作用

我可以先运行onClick吗?除非onClick需要window.location,否则这段代码似乎不起作用?

<a onclick="click.php?add=yes&goto=http://refererurl.com/" href="http://refererurl.com/">advert</a>
Run Code Online (Sandbox Code Playgroud)

这有点像Google,其中用户和搜索引擎认为链接是http://refererurl.com/ - 但是,用户首先获取click.php文件然后重定向.

html redirect onclick href

-1
推荐指数
1
解决办法
5907
查看次数

如何使用jquery获取父元素的href属性?

我有这个html树的例子

<div class="auditions_date">
    <div class="new_green above_deadline"><a href="/auditions/2 ?>">Contact</a></div>
    <span class="aud_recommend"><a class="222" id="aud_recommend" href="#recommend_data">test</a></span>
</div>
<div class="auditions_date">
    <div class="new_green above_deadline"><a href="/auditions/3 ?>">Contact</a></div>
    <span class="aud_recommend"><a class="333" id="aud_recommend" href="#recommend_data">test</a></span>
</div>
Run Code Online (Sandbox Code Playgroud)

当我点击test链接时,我想获得标签的hrefattra

也许:

$('a#aud_recommend').on("click", function() {
        var j = $(this).parent('.auditions_date').find('a').attr('href');
    console.log(j);
});
Run Code Online (Sandbox Code Playgroud)

这似乎没有正常工作..任何想法?

谢谢

jquery parent href find attr

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

HTML链接不起作用 - 这应该不难

这是一个功能完善的页面,其中包含工作样本的链接.我添加了一些XML工作,该链接将无法运行.我无法弄清楚为什么.如果它显而易见,我道歉.谢谢!

<!DOCTYPE html>
<html>
    <head>
        <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
        <title></title>
    </head>
    <body>
        <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
        <center>
            <a href="C++/index.html"><div class="friend"><p>C++</p></div></a>
            <a href="SQL/index.html"><div class="family"><p>SQL</p></div></a>
            <a href="OS/index.html"><div class="enemy"><p>OS</p></div></a>
            <a href-"XML/index.html"><div class="friend"><p>XML</p></div></a>
            <a href="Miscellaneous/index.html"><div class="family"><p>Miscellaneous</p></div></a>
            <a href="http://github.com/"><div class="enemy"><p>GitHub</p></div></a>




        </center>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是样式表:

div {
    position: relative;
    display: inline-block;
    height: 100px;
    width: 100px;
    border-radius: 100%;
    border: 2px solid black;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
}

div p {
    position: relative;
    margin-top: 40px;
    font-size: 16px;
}

.friend {
    border: 4px solid green;
}

.family {
    border: 4px …
Run Code Online (Sandbox Code Playgroud)

html href

-1
推荐指数
1
解决办法
246
查看次数

如何查找或解密 javascript:void(0) 的 url

好吧,我刚刚从互联网上下载了一个代码,它有

<a href="javascript:void(0)" class="action">login</a>
Run Code Online (Sandbox Code Playgroud)

当我点击它时,它会显示一个弹出窗口。我想在任何其他按钮上使用该弹出框,但不知道该怎么做。任何人都可以向我解释如何完成或当前给定的行是如何工作的。我只是这个新手,所以如果这是一个愚蠢的问题,请不要生气。谢谢

html javascript anchor href void

-1
推荐指数
1
解决办法
2167
查看次数

如何使用JQuery从列表中获取所有href值?

我想href用JQuery 从属性中检索所有URI .我怎么能这样做?

这是HTML的一个例子

<ul class="nav navbar-nav"> 
    <li class="active"><a href="www.myweb.com/home">Home <span class="sr-only">(current)</span></a></li> 
    <li><a href="www.myweb.com/findyourcity">Find Your City</a></li> 
    <li><a href="www.myweb.com/howitwork">How It Works</a></li> 
    <li><a href="www.myweb.com/faq">FAQ</a></li> 
</ul>
Run Code Online (Sandbox Code Playgroud)

jquery href

-3
推荐指数
1
解决办法
3957
查看次数

如何使用javascript提取&lt;main&gt;元素内的所有href

我试图创建一个数组,使用javascript main元素中保存所有href。现在我不是程序员,但我想我会尝试通过以下两种方法之一来实现:

a)隔离主要元素(document.getElementsByTagName(“ main”)),然后尝试从该对象中提取所有href。

b) Create an array of all href's on the page (document.links) and then check for every href whether it has main as a parent node.

So far I haven't found a solution for either approach. Can anyone help me with a code fragment that creates an array with all href's within main? Thanks a lot in advance. I already spent hours figuring it out myself xl

Example …

javascript arrays href

-3
推荐指数
1
解决办法
43
查看次数

标签 统计

href ×8

html ×3

javascript ×3

jquery ×2

anchor ×1

arrays ×1

asp.net ×1

attr ×1

eval ×1

find ×1

onclick ×1

parent ×1

php ×1

redirect ×1

void ×1