【发布时间】:2020-07-15 19:05:38
【问题描述】:
我想用js修改,但我做不到。我没有错误信息。
js
<!-- language: lang-js -->
function taux() {
let rue = document.getElementById("input-rue").value;
let tauxrue = document.getElementById("tr");
tauxrue.innerText = rue;
<!-- language: lang-html -->
svg/html
<text id="_33ème_édition_-_1019ème_gp" data-name="33ème édition - 1019ème gp" class="cls-5" transform="translate(122 162)"><tspan x="0" y="0" id="tr">33</tspan><tspan class="cls-6" y="0">ÈME</tspan><tspan y="0" xml:space="preserve"> ÉDITION - 1019</tspan><tspan class="cls-6" y="0">ÈME</tspan><tspan y="0" xml:space="preserve"> GP</tspan></text>
【问题讨论】:
-
我看不到您的
let rue = document.getElementById("input-rue").value;元素在您的代码中的位置。 -
我注意到的第一件事是你没有关闭 js 中的函数括号
-
你好,js在js文件里但是我不明白你的问题。
-
input-rue 这只是我输入的 id
-
也许这会对你有所帮助:stackoverflow.com/a/4282289/2610061
标签: javascript html css svg tspan