神秘主义.
我使用XSLT接收参考地址.
<a href="{element/url}"/>
Run Code Online (Sandbox Code Playgroud)
在XML中,我有:
<element>
<url>www.mysite.ru</url>
</element>
Run Code Online (Sandbox Code Playgroud)
因此,我在页面上收到:
<a href="www.currentsite.ru/cursection/cursubsection/www.mysite.ru"/>
Run Code Online (Sandbox Code Playgroud)
也就是说:在开头有一个当前站点的地址(我们现在所在的当前段的地址),然后有一个对外部站点的引用.
metatag BASE可能有任何问题吗?
真是个麻烦?
我有
echo <a href=\"javascript:;\" onClick=\"window.open('". $link ."','no','scrollbars=yes,width=550,height=400')\" >View report</a>
Run Code Online (Sandbox Code Playgroud)
$ link包含敏感信息,所以我想知道当你在浏览器上"查看源代码"时,是否有一种简单的方法可以防止此链接显式出现.href的任何替代方案都可以.我只需要给用户一个选项,在他提交一些数据后点击并查看他的处理结果.我希望在提交处理后尽快避免自动弹出窗口.
更新:所以$ link是一个包含用户ID和密码的GET URL ..它现在是内部的,所以很好,但我想将来把它放在我们的在线服务器上.我是PHP的新手,所以这可能不是在不久的将来,因为我不太了解需要为互联网上的实时网站实现的安全功能.现在,似乎利用数据库将是最好的方式.如果我错了请纠正我,拜托,并感谢所有人的支持!
我需要在一些HTML代码的一部分中找到链接,并用两个不同的绝对或基本域替换所有链接,然后是页面上的链接...
我找到了很多想法并尝试了很多不同的解决方案.在这一方面运气不好......请帮助我!谢谢!!
这是我的代码:
<?php
$url = "http://www.oxfordreference.com/views/SEARCH_RESULTS.html?&q=android";
$raw = file_get_contents($url);
$newlines = array("\t","\n","\r","\x20\x20","\0","\x0B");
$content = str_replace($newlines, "", html_entity_decode($raw));
$start = strpos($content,'<table class="short_results_summary_table">');
$end = strpos($content,'</table>',$start) + 8;
$table = substr($content,$start,$end-$start);
echo "{$table}";
$dom = new DOMDocument();
$dom->loadHTML($table);
$dom->strictErrorChecking = FALSE;
// Get all the links
$links = $dom->getElementsByTagName("a");
foreach($links as $link) {
$href = $link->getAttribute("href");
echo "{$href}";
if (strpos("http://oxfordreference.com", $href) == -1) {
if (strpos("/views/", $href) == -1) {
$ref = "http://oxfordreference.com/views/"+$href;
}
else
$ref = "http://oxfordreference.com"+$href;
$link->setAttribute("href", $ref);
echo …Run Code Online (Sandbox Code Playgroud) 这是HTML和CSS代码:
#spanUpdBrowserSuggestions a {
font-family: Tahoma, Geneva, sans-serif;
font-size: 12pt;
font-weight: bold;
text-decoration: none;
color: #000000;
}
#spanUpdBrowserSuggestions a:hover {
color: #FF0000;
}Run Code Online (Sandbox Code Playgroud)
<span name="spanUpdBrowserSuggestions" id="spanUpdBrowserSuggestions">
<ul>
<li><a href="http://www.mozilla.com/en-US/firefox/new/" target="_new">Firefox</a><br></li>
<li><a href="http://www.opera.com/download/" target="_new">Opera</a><br></li>
<li><a href="http://www.google.com/chrome/index.html" target="_new">Chrome</a><br></li>
<li><a href="http://windows.microsoft.com/en-US/internet-explorer/downloads/ie" target="_new">Explorer</a><br></li>
</ul>
</span>Run Code Online (Sandbox Code Playgroud)
在Firefox,Opera,甚至IE中它都应该显示:黑色链接正常,红色悬停.在基于Webkit的浏览器中(谷歌浏览器和Safari)它显示为带有下划线的普通蓝色链接.
有什么想法有什么不对吗?
这个脚本:
$(function() {
$('a').each(function() {
var href = $(this).attr('href');
if ("a:not(http://)") {
$(this).attr('href', '/' + href);
}
});
});
Run Code Online (Sandbox Code Playgroud)
将斜杠添加到每个链接甚至包含"http://"的链接不知道为什么?我没有收到任何错误?
关于如何解决这个问题的任何想法?
好的这次代码让我发疯了
我花了2个多星期使用e.preventDefault()并返回flase以防止onclick href进入页面顶部,但它们不起作用
我用javascript:void(0)它停止滚动窗口到顶部,但输入字段没有生成.
我确定在我的代码中使用这些解决方案存在问题,如果在我的代码中使用这两种方法有问题请告诉我
我的代码:
我正在尝试使用PHP和jquery构建一个向导
在此向导的第2步中,我想在用户单击时动态生成输入字段
<h2><a href="#" id="addScnt">Add Another Input Box</a></h2>
这是Javascript
$(document).ready(function(){
/*****************************/
$('#table_name_error').hide();
// all content starts hidden
$('.wizardcontent').hide();
$('#wizardcontent').hide();
// initialize the wizard state
load_state(1);
// loads new state based on button clicked
$(':button').click(function(){
//reset the wizardcontent to hidden
//$('#wizardcontent').hide();
//load_state(++current_state);
var current_state = $('#wizard').attr('class');
//we only want the number, converted to an int
current_state = parseInt(current_state.replace(/(step_)/, ""));
//figure out if 'next' or 'previous' was clicked and load appropriate state
if ($(this).attr('id') …Run Code Online (Sandbox Code Playgroud) 在我的页面上,我使用此代码和一些CSS设置了3个选项卡
<ul class="subnav" id="subnav">
<li class="active"><a href="#subover">Overview</a></li>
<li><a href="#subnews">News</a></li>
<li><a href="#subgallery">Gallery</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
在新闻标签内,我正在使用.load来填充页面arc.php和id = news.
<div class="subcont" id="subnews">
<script>
jQuery(document).ready(function ($) {
$('#subnews').append($('<div>').load('arc.php #news'));
});
</script>
</div>
Run Code Online (Sandbox Code Playgroud)
在arc.php页面上,我有包含文章链接的新闻说明.单击文章链接时.我希望它加载到subnews div.我正是这样做的.
<script>
jQuery(document).ready(function ($) {
$("#subnews").on("click", "a", function (e) {
$("#subnews").load($(this).attr("href"));
e.preventDefault();
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
现在我的问题......
加载新闻文章时,网址不会更改,因此我无法使用返回到新闻文章列表.
我确实有代码跟踪哈希标签,当我从概述,新闻和图库更改时,它可以工作.我可以使用back返回选项卡.
有没有办法在单击文章时向网址添加哈希标记,以便使用跟踪并能够单击回来?
我将以下变量附加到'QTextBrowser'.它确实显示为链接,但当我点击它时,'QTextBrowser'中的所有文本都会消失.'anchorClicked'信号所连接的所有函数都是在shell中打印的东西,以便我知道接收到了信号.
word = '<a href>' + '<span style="background-color:#C0C0C0">' + word + '</span>' +'</a>'
self.textBrowser.anchorClicked.connect(self.test)
def test(self,argv_1):
print('!!!')
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用jQuery附加链接,但它无法正常工作.这是我的代码.
$(document).ready(function() {
$( ".class" ).append( "<p><a href="http://www.google.com">Google</a></p>" );
});
Run Code Online (Sandbox Code Playgroud) 我试图将PHP变量添加到href url
这是代码:
PHP
$uid= $_SESSION['userid'];
Run Code Online (Sandbox Code Playgroud)
HTML
<a href=http://example.com/uid= <?php echo ".$uid."?> /a>
Run Code Online (Sandbox Code Playgroud)
你如何添加,当我这样做时,这也是它的重定向:http://example.com/uid=.
href ×10
jquery ×4
php ×3
html ×2
append ×1
css ×1
hash ×1
hyperlink ×1
javascript ×1
preg-replace ×1
pyqt ×1
pyside ×1
python-3.x ×1
qtextbrowser ×1
replace ×1
safari ×1
url ×1