JS-为什么不是';我的JavaScript src不能工作吗?

JS-为什么不是';我的JavaScript src不能工作吗?,javascript,jquery,Javascript,Jquery,这是我的代码摘录: <form name="calculator"> <input type="button" name="latest" value="You are not using the latest version."> <script src="http://www.alvinneo.com/bulbuleatsfood.js"> if(latest-version==="1.0.4.2"){ document.calculator.latest

这是我的代码摘录:

<form name="calculator">
<input type="button" name="latest" value="You are not using the latest version.">
<script src="http://www.alvinneo.com/bulbuleatsfood.js">
if(latest-version==="1.0.4.2"){
document.calculator.latest.value="You are using the latest version.";
};
</script>
</form>

如果(最新版本==“1.0.4.2”){
document.calculator.latest.value=“您使用的是最新版本。”;
};
出于某种原因,这是行不通的。有什么提示吗?

请参见:

src: 此属性指定外部脚本的URI;这个可以 可以作为直接在脚本中嵌入脚本的替代方法 文件。如果脚本元素指定了src属性,则它应该 没有在其标记中嵌入脚本

将代码更改为:

<form name="calculator">
  <input type="button" name="latest" value="You are not using the latest version.">

  <!-- script with src (not containing embedded code) -->
  <script src="http://www.alvinneo.com/bulbuleatsfood.js"></script>

  <!-- another script (containing embedded code but not src) -->
  <script>
    if(latest-version === "1.0.4.2") {
      document.calculator.latest.value = "You are using the latest version.";
    };
  </script>
</form>

如果(最新版本==“1.0.4.2”){
document.calculator.latest.value=“您使用的是最新版本。”;
};

您可以告诉我们您希望您的代码做什么,以及它做什么。
脚本
带有src的标记不能包含代码:
!好吧,在不知道它的工作方式的情况下,我可以告诉您,JavaScript中不允许使用带有连字符的变量,因此
最新版本
将无法运行。可以尝试
最新版本
最新版本