嘿,我有一个javascript的问题.我需要为锚标记或asp:HyperLink分配一个href值.一些东西.这将允许我将对话框弹出窗口中的文本链接到函数指定的href.这是我的代码.
<'custom:JQueryDialog I made' runat=server ID="dialogPopUp" AutoOpen="false"
CloseOnEscape="true" Modal="true" Title="Download" width="300px">
//I will spare you all of the div tags for formatting
<a runat="server" id="downloadLink" target="_blank" class="'css with an icon'"
href=""></a>
</'custom:JQueryDialog I made'>
Run Code Online (Sandbox Code Playgroud)
现在我不得不从数据库中获取fso,因为这是存储信息的地方.这个fso根据实体反射器类发送给这个javascript的不同而不同.我有一个函数,格式化类似于我发现的C#的javascript字符串.然后我有另一个函数从实体反射器类获取fso.这有效.我通过在警报中显示它来测试字符串,这很好.我遇到的问题是使用javascript设置锚标记的href.我疯了!请帮忙!
字符串格式:
String.format = function() {
var s = arguments[0];
for (var i = 0; i < arguments.length - 1; i++) {
var reg = new RegExp("\\{" + i + "\\}", "gm");
s = s.replace(reg, arguments[i + 1]);
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试更改href:
function changeHref(fso) {
var downloadHref …Run Code Online (Sandbox Code Playgroud) 我有一个简单的Javascript函数,它构建了一个我想提供链接的Url.
但是,我似乎无法使用锚标签.如何为锚标记的href指定Javascript函数的结果?
这些都不能正常工作:
<a href="getUrl();">Click here</a>
<a href="javascript:getUrl();">Click here</a>
Run Code Online (Sandbox Code Playgroud)
这就是我想要完成的.
我想解析这个链接:
<a href="http://www.google.fr">Link to google</a>
Run Code Online (Sandbox Code Playgroud)
为了获得两个结果:
Link = "http://www.google.fr"
LinkName = "Link to google"
Run Code Online (Sandbox Code Playgroud)
我真的不知道怎么做,Java中是否有一个库可以解决这个问题?
提前致谢,
在动态Web项目中,我有 - default.html页面
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="./Styles/Site.css" type="text/css" />
<title>Create new customer</title>
</head>
<body>
<a href="\WEB-INF\forms\CustomerMenu.jsp">Test new</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我还有CustomerMenu.jsp页面 -
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="./Styles/Site.css" type="text/css" />
<title>Create new customer</title>
</head>
<body>
// Table ..
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
页面层次结构如快照 -

当我按下default.html中的链接时,我收到错误消息
- HTTP Status 404 -
--------------------------------------------------------------------------------
type Status report
message
description The requested resource () is not available.
Run Code Online (Sandbox Code Playgroud) 我想构建一个JS外部脚本(标记)来停止代码(通常不是我的)像location.href一样,不使用弹出窗口.我尝试过这样的事情:
$(window).bind('beforeunload', function() {
window.stop();
event.stopImmediatePropagation();
event.preventDefault();
location.href = '#';
});
Run Code Online (Sandbox Code Playgroud)
但似乎没有任何帮助.再一次,我需要它而不使用:return"你确定吗?" 也许是一个不同的回调?
谢谢,丹
我们正在尝试在HTML页面中创建一个超链接,该超链接应该打开预定义的短信 - 当用户在我们的页面上点击此链接时,SMS应用程序应该打开预定义的数字和正文.我们能够成功设置数字,但我们无法设置此短信的正文.可能吗?
我们到目前为止尝试的链接是:
<a href="sms:123456789?body=sometext">sms link</a>
非常感谢您的帮助!
我在编写XSL时遇到问题.我有以下代码的链接:
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($myUrl,'&projectNumber=',$projectNumber)"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="title"/>
</xsl:attribute>
LINK
</a>
Run Code Online (Sandbox Code Playgroud)
所以我需要将变量传递projectNumber给结尾myUrl.这很好用,我得到...myUrl...&projectNumber=...projectNumber...HTML.
问题是,变量projectNumber有时会有一些必须在链接的href中转义的字符.我试过str:escape-uri()很多不同的方式使用XSL功能,但仍然没有成功......
例如,如果myUrl www.example.com/example.aspx?a=b和projectNumber是aaa?aaa
我得到的href www.example.com/example.aspx?a=b&projectNumber=aaa?aaa,但我需要得到www.example.com/example.aspx?a=b&projectNumber=aaa%C5%ABaaa.(%C5%AB是'ū'逃脱的方式)有什么建议吗?谢谢.
根据我的一个要求,我需要通过调用服务来打开默认的邮件客户端,这需要使用锚标签或纯html来完成,约束是我们不能使用javascript.有没有人知道如何做到这一点?
我创建了两个框架,分别包含两个链接.
单击第一帧时,我想在第二帧中显示JSP页面.
但我无法让它发挥作用.单击第一帧时,它将在新窗口中打开JSP页面.
我粘贴了一些代码.
这是我的main.jsp
<html>
<frameset cols="50%,50%">
<frame src="frame1.jsp">
<frame src="frame2.jsp">
</frameset>
</html>
Run Code Online (Sandbox Code Playgroud)
frame1.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Frame 1 with links</title>
</head>
<body>
<body bgcolor="lightBlue">
<h2>Java Tutorial</h2>
<a href="subframe1.jsp" target="frame2.jsp"> tracking system</a>
<a href="subframe2.jsp" target="frame2.jsp">data information</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
frame2.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
subframe1.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="insertData.jsp" action="post" >
DATA ID:<input type="text" name="data_id"><br>
East:<input type="text" name="east"><br>
North:<input type="text" name="north"><br> …Run Code Online (Sandbox Code Playgroud) 我在多个视图之间使用角度路由,并尝试在每个路由更改时填充公共面包屑列表.这工作正常,但面包屑中的超链接不起作用.
基本上我有一个网站,其中包含以下视图:
意见/ main.html中
意见/ page_a.html
意见/ page_b.html
和结构:
main> page a> page b
$rootScope.$on('$routeChangeSuccess', function(scope, next, current) {
var thisView = next.loadedTemplateUrl;
if (!thisView) return;
var breadcrumb = jQuery('#breadCrumb'); //<ol> container
breadcrumb.empty();
if (thisView.indexOf('page_a') >= 0) {
breadcrumb.append('<li><a href="#/main">main</a></li>');
breadcrumb.append('<li class="active">page a</li>');
}
else if (thisView.indexOf('page_b') > 0) {
breadcrumb.append('<li><a href="#/main">main</a></li>');
breadcrumb.append('<li><a href="#/page_a">page a</a></li>');
breadcrumb.append('<li class="active">page b</li>');
}
});
Run Code Online (Sandbox Code Playgroud)
不幸的是,这些超链接没有到正确的地方.我想我已经尝试了所有组合,例如#/ page_a,#/ page_a.html,/ views/page_a.html,......但没有运气.觉得这应该不难,但是已经很晚了所以我希望得到一些帮助.谢谢!
编辑
我的路线设置如下:
app.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/page_a', {
templateUrl: …Run Code Online (Sandbox Code Playgroud)