在 Jenkins 的可编辑电子邮件通知对话框中使用 <script> 标签
Using <script> tag within editable email notification dialog in Jenkins
我在可编辑的电子邮件通知对话框中写下这个简单的html:
<!DOCTYPE html>
<html>
<body>
<p id="demo"> </p>
<script type="text/javascript">
document.getElementById("demo").innerHTML = "this is from JS";
</script>
</body>
</html>
但是我在生成的电子邮件中看不到字符串“this is from JS”。不确定我做错了什么?有什么指点吗?
你有你的JS,但是你好像从来没有调用过它。
在加载或就绪函数中尝试 运行。
<script type="text/javascript">
window.onload = function() {
document.getElementById("demo").innerHTML = "this is from JS";
};
$( document ).ready(function() {
document.getElementById("demo").innerHTML = "this is from JS";
});
</script>
我想这就是你想要做的。
更新:
好的,我找到了另一个适合你的功能。这是 FIDDLE.
<body>
<p id="demo"></p>
<script>
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("demo").innerHTML = "this is from JS";
});
</script>
</body>
我在可编辑的电子邮件通知对话框中写下这个简单的html:
<!DOCTYPE html>
<html>
<body>
<p id="demo"> </p>
<script type="text/javascript">
document.getElementById("demo").innerHTML = "this is from JS";
</script>
</body>
</html>
但是我在生成的电子邮件中看不到字符串“this is from JS”。不确定我做错了什么?有什么指点吗?
你有你的JS,但是你好像从来没有调用过它。 在加载或就绪函数中尝试 运行。
<script type="text/javascript">
window.onload = function() {
document.getElementById("demo").innerHTML = "this is from JS";
};
$( document ).ready(function() {
document.getElementById("demo").innerHTML = "this is from JS";
});
</script>
我想这就是你想要做的。
更新:
好的,我找到了另一个适合你的功能。这是 FIDDLE.
<body>
<p id="demo"></p>
<script>
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("demo").innerHTML = "this is from JS";
});
</script>
</body>