简体   繁体   English

将js附加到mojoPortal

[英]Attach js into mojoPortal

I have wrote JS calculator and need include it into mojoPortal site. 我已经写了JS计算器,需要将其包含在mojoPortal网站中。 I have upload js files to directory /calculator/ and add script tags at page content. 我已将js文件上传到目录/ calculator /,并在页面内容上添加了脚本标签。 But when browser request http://example.com/calculator/calculator.js it get 500 error: 但是,当浏览器请求http://example.com/calculator/calculator.js时 ,会出现500错误:

Runtime Error 运行时错误

Description: An exception occurred while processing your request. 说明:处理您的请求时发生异常。 Additionally, another exception occurred while executing the custom error page for the first exception. 此外,在执行第一个异常的自定义错误页面时发生另一个异常。 The request has been terminated. 该请求已终止。

How I can disable execution of this folder or attach files in code? 如何禁用该文件夹的执行或在代码中附加文件?

Rather than trying to open the javascript file directly from the webserver you need to embed it in a web page like this: 无需尝试直接从网络服务器打开javascript文件,您需要将其嵌入如下所示的网页中:

<html>
<head><script type="text/javascript" src="myfile.js"></script></head>
<body><p>Code running...</p></body>
</html>

In terms using javascript in Mojoportal, there is a custom javascript module which you can use to insert javascript into a Mojoportal page see adding custom javascript 就在Mojoportal中使用javascript而言,有一个自定义javascript模块,可用于将javascript插入Mojoportal页面中, 请参阅添加自定义javascript。

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

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