JavaScript的升级,增加了一个链接到一个场 [英] upgrading javascript that adds a link to a field

查看:218
本文介绍了JavaScript的升级,增加了一个链接到一个场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图销售阶段字段标签更改为超链接,弹出一个新的浏览器窗口。

目前我有一个销售阶段现场,有一个下拉::形式

Currently I have a form with a Sales Stage field that has a drop down::

底层的HTML:

<td title="Select the sales process stage for the opportunity to indicate the probability of closing the opportunity." class="ms-crm-ReadField-Normal ms-crm-FieldLabel-LeftAlign" id="salesstagecode_c"><span class="ms-crm-InlineEditLabel"><span class="ms-crm-InlineEditLabelText" style="text-align: left; max-width: 115px;">Sales Stage</span><div class="ms-crm-Inline-GradientMask" style="display: none;">
</div></span></td>

或者更好的格式:

or perhaps better formatted:

这是我用$ P $的功能pviously制作表格的旧版本:

The function that I used previously worked on an older version of the form:

function csjs_AddHyperlinkToLabel(sFieldId, sURL, sWindowOptions) {
    var sCurrentLabel = $("label[for='" + sFieldId + "']").html();
    $("label[for='" + sFieldId + "']").html("<a href=\"#\" onclick=\"window.open('" + sURL + "', null, '" + sWindowOptions + "'); return false;\" style=\"cursor:hand; color:blue; text-decoration:underline;\">" + sCurrentLabel + "</a>");
} 

在功能上面曾与下面的HTML ::

the function above worked on a form with the following html::

将需要的JavaScript到销售阶段字段标签更改为超链接,弹出一个新的浏览器窗口中什么样的变化?

虽然我会很感激的解决方案,我正在寻找指导如何做到这一点。感谢您的关注和时间。

Though I'd be very grateful for a solution, I'm looking for guidance on how to accomplish this. Thank you for your attention and time.

不幸的是,下面的解决方案没有工作。我跑这通过调试器,这是我得到了 http://screencast.com/t/fT6tHvXZzvc

Unfortunately, the solutions below did not work. I ran this through the debugger and here's what I got http://screencast.com/t/fT6tHvXZzvc

这里的问题是,我们正在通过salesstage code这个功能:

The issue here is that we are passing "salesstagecode" to this function:

csjs_AddHyperlinkToLabel("salesstagecode", sPageURL, sWindowFeatures);

这原来是NULL:

and this turns out to be NULL:

var sCurrentLabel = $("label[for='" + sFieldId + "']").html();

*

问题是,微软改变了形式的呈现方式和   渲染页面的HTML将不再与工作方式的   函数编写的。标签是一个现在的跨度标签,而不是   标签标记。我不知道是否有一种方法,以确定该跨度和   修改的内容有新的HTML,使文本链接。

The issue is that Microsoft changed the way the forms are rendered and the HTML of the rendered page will no longer work with the way the function was written. The label is now in a span tag instead of a label tag. I don't know if there is a way to identify that span and change the contents to have new HTML to make the text link.

*

如何更新span标记?

推荐答案

简单:

变更

 .... onclick=\"window.open('" + sURL + "', null, '" ....

 .... onclick=\"window.open('" + sURL + "', '_blank', '"  ....

这篇关于JavaScript的升级,增加了一个链接到一个场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆