简体   繁体   English

有没有办法在不使用<script>标签的情况下使用javascript代码?

[英]Is there a way to use javascript code without using <script> tag?

So I'm working on my online portfolio using prosite.com and I created some simple hover thingy using javascript ( http://wojtek.szukszto.com/index.html ). 所以我正在使用prosite.com开发我的在线投资组合,并使用javascript( http://wojtek.szukszto.com/index.html )创建了一些简单的悬停东西。 The problem is prosite.com won't allow me to use < script > tag... Is there any way to do it? 问题是prosite.com不允许我使用<script>标签......有什么办法吗? Maybe as an external html? 也许作为外部HTML? I don't know... I'm not really good in coding, so any help would be appreciated. 我不知道......我的编码不是很好,所以任何帮助都会受到赞赏。

You can have them as DOM Events like 您可以将它们作为DOM事件

<div onclick="alert('cat');">
  I <strong>Really</strong> want a cat!
</div>

 <body onload="//you can put a whole bunch of stuff here"></body>
 (It is equivalent to window.onload = function(){ //stuff })

You can put your javascript code into external file and call in the head section of your html document 您可以将您的javascript代码放入外部文件,并在html文档的head部分调用

<head>    
<script src ="/JS/yourjsfile.js"></script>
</head>    

hope that your host allows you to call JS in the head section 希望你的主机允许你在head部分调用JS

The way I do it is by stating the type of script. 我这样做的方法是说明脚本的类型。 The ProSite already has javascript integrated within itself. ProSite已经集成了javascript。 I use: 我用:

<script type="javascript"> Code-Goes-Here </script>

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

相关问题 JavaScript代码注入不带<script> tag - JavaScript code injection without a <script> tag 有没有办法在没有<script> tag? - Is there a way to use ionicons without the <script> tag? Javascript 库没有在脚本标签中使用导入 - Javascript library without using an import in the script tag 如何将 JavaScript 代码拆分为多个文件并在不通过 HTML 中的脚本标签包含它们的情况下使用它们? - How to split JavaScript code into multiple files and use them without including them via script tag in HTML? 如何在不使用脚本标记的情况下包含外部 javascript 文件 - How to include external javascript file without using the script tag JavaScript代码内部<script>标记 - JavaScript Code Inside <script> Tag 有没有一种方法可以在JavaScript中编写事件处理程序,而无需将其添加到标记中或使用addEvent? - Is there a way to write an event handler in JavaScript without adding it to the tag or using addEvent? 在页面加载时运行javascript代码,而不使用onload标记 - Running javascript code on page load, without using the onload tag 有没有办法在WordPress文章的html代码中使用JavaScript脚本? - Is there a way to use a JavaScript script in the html code of a WordPress article? 如何加载没有脚本标记的Javascript文件? - How to load a Javascript file without Script tag?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM