English 中文(简体)
javascript中引用的添加了链接
原标题:Add quote in javascript generated links
  • 时间:2009-10-30 16:47:53
  •  标签:

如何在javascript中确定这一联系。

<a href="javascript:clientGalleryLink(Business)">Link</a>

该公司在商业领域缺少单一报价

Javascript:

html += "<option value= javascript:clientGalleryLink(" + titleArray[x] + ") >" + titleArray[x] + "</option>";
最佳回答

缩略语

html += "<option value= javascript:clientGalleryLink("" + titleArray[x] + "") >" + titleArray[x] + "</option>";
问题回答
<a href= javascript:clientGalleryLink("Business") >Link</a>
html += "<option value= javascript:clientGalleryLink("" + titleArray[x] + "") >" + titleArray[x] + "</option>";

请你尝试。

Thanks。

恳求这样做是为了避开你所引述的属性,从而给你像你在你身上所展示的那种独一无二的quot。

html += "<option value="javascript:clientGalleryLink( " + titleArray[x] + " )">" + titleArray[x] + "</option>";

由此引起的问题正是为什么最好避免在扼杀中动态地制造 Java本-超文本。 <代码>javascript: 绝不应使用假肢-URL计划。

相反,考虑采用“侵扰性描述”的方法:将数据从嵌入式的“共同提交书”和“正常属性”,如<代码>>>>>> ,或者如果链接与网页上的特定内容相对应,则<代码>href。 本身:

<a class="gallerylink" href="#Business">Link</a>

for (var i= document.links.length; i-->0;) {
    if (document.links[i].className=== gallerylink ) {
        document.links[i].onclick= function() {
            clientGalleryLink(this.hash.substring(1));
            return false;
        };
    }
}

第二个例子:

html += "<option value= javascript:clientGalleryLink(" + titleArray[x] + ") >" + titleArray[x] + "</option>";

只是一点。 除了在标题Array值上引用的外,在标题Arrays上缺乏超文本自动或联合-加强-便利计算(如果你有<代码>)。 “<& natures in the name You ve got problems.

您是否期望在选择该办法时执行该书,只是因为你将该文本列入<代码>:<>数值/代码>? 它赢得胜利。

最好使用DOM物体,而不是在超文本中添加 Java语。 例如,如果你重新寻找一个称为<编码>的箱子。 选择方案每次改变:

<div id="PlaceWhereYouWantToPutTheSelectBox"></div>

<script type="text/javascript">
    var s= document.createElement( select );
    for (var i= 0; i<titleArray.length; i++) {
        s.options[i]= new Option(titleArray[i], titleArray[i]);
    }
    s.onchange= function() {
        clientGalleryLink(this.options[this.selectedIndex].value);
    };
    document.getElementById( PlaceWhereYouWantToPutTheSelectBox ).appendChild(s);
</script>

没有必要,没有交叉描述的安全漏洞。

添加斜体:

"" + titleArray[x] + ""




相关问题
热门标签