简体   繁体   English

Drupal视图中的Javascript链接

[英]Javascript link in drupal view

I'm telling the view to display a field with the NID contents. 我告诉视图显示具有NID内容的字段。 I'm telling it that I wish to "Rewrite the output of this field" and I enter: 我告诉我要“重写此字段的输出”,然后输入:

<a href=”javascript:void(0);”  onclick="javascript: approve([nid])" >Approve</a>

When viewing the page, all the javascript has been stripped. 当查看页面时,所有的javascript都已被剥离。 How do I get views to accept javascript in the link, or what other way can I use to display a link? 如何获得视图以接受链接中的javascript或可以使用其他什么方式显示链接?

Note: Custom Text field doesn't work either. 注意:“自定义文本”字段也不起作用。

Found the solution! 找到了解决方案! http://drupal.org/project/views_customfield http://drupal.org/project/views_customfield

From the description: 根据描述:

This module provides some useful (views)fields. 该模块提供了一些有用的(视图)字段。 Available (views)fields: Markup Field that allows usage of custom text and the input filter system. 可用(视图)字段:允许使用自定义文本和输入过滤器系统的标记字段。 PHP code Field that allows usage of custom PHP code (with access to view's database result) Rownumber Field containing rownumber (respects pagers). PHP代码允许使用自定义PHP代码的字段(可以访问视图的数据库结果)Rownumber包含行号的字段(尊重寻呼机)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM