简体   繁体   English

如何将此js代码连接到外部工作表并连接到html?

[英]How to connect this js code to the external sheet and connect to the html?

I have obfuscated an email address using Hiveware Enkoder.我使用 Hiveware Enkoder 混淆了一个电子邮件地址。 The result is below.结果如下。

obfuscated code混淆代码

I usually place it inside the div just as is.我通常将它原样放在 div 中。

But I would prefer to include it in an external file and create less text in my code.但我更愿意将它包含在一个外部文件中,并在我的代码中创建更少的文本。 I know how to copy it properly to a sheet and place the path and syntax in the head, but I do not know how to connect the file to the div where it should function.我知道如何将它正确复制到工作表并将路径和语法放在头部,但我不知道如何将文件连接到它应该运行的 div。

Thank you for any help.感谢您的任何帮助。

/Pat /拍

Making a bunch of assumptions here (because we can't see what your code does and transcribing a picture of text back to text in order to decode it would be far more effort then I'm willing to put in):在这里做一堆假设(因为我们看不到你的代码做了什么,将文本图片转录回文本以解码它会比我愿意投入的努力要多得多):

You seem to be operating under the misapprehension that using a src attribute for a script instead of inlining it requires that you place the script in the head .您似乎误以为使用scriptsrc属性而不是内联它需要您将脚本放在head

That is not the case.事实并非如此。 If your script inserts content into the DOM at the point of the script element, then just put the script element where you want the content.如果您的脚本在script元素的位置将内容插入到 DOM 中,那么只需将脚本元素放在您想要内容的位置。

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

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