18910140161

JavaScript-不是在浏览器中打开消息框,而是将值发送到文本栏-堆栈溢出

顺晟科技

2022-10-18 12:18:47

127

当我打开框并选择一个值时:

enter image description here

它在浏览器的消息框中提供相应的链接:

enter image description here

我希望这个值不是出现在消息框中,而是出现在文本栏中,我需要修改或添加哪一行代码才能使最终结果发生变化?

预期结果:

enter image description here

我的剧本:

<代码><;HTML(>;)<;头部>;<;标题>;<;/标题>;<;/标题>;<;身体>;<;输入类型=";文本";名称=";URL1";ID=";URL1";style=";宽度:283px;";/>;<;脚本SRC=";http://d3js.org/d3.v3.js"><;脚本>;D3.CSV(";lista_de_jogos.CSV";,函数(错误,数据){var select=D3.select(";body";).append(";DIV";).追加(";选择";)选择.ON(";CHANGE";,函数(D){var value=D3.select(this).property(";value";);警报(值);});选择。选择所有(";选项";).数据(数据).输入().append(";选项";).ATTR(";value";,函数(d){return d.value;}).text(函数(d){返回d.label;});});<;/脚本>;<;/正文>;<;/HTML>;

顺晟科技:

删除行<html> <head> <title></title> </head> <body> <input type="text" name="url1" id="url1" style="width: 283px;" /> <script src="http://d3js.org/d3.v3.js"></script> <script> d3.csv("Lista_de_Jogos.csv", function(error, data) { var select = d3.select("body") .append("div") .append("select") select .on("change", function(d) { var value = d3.select(this).property("value"); alert(value); }); select.selectAll("option") .data(data) .enter() .append("option") .attr("value", function (d) { return d.value; }) .text(function (d) { return d.label; }); }); </script> </body> </html> 。并附加此代码

alert(value);

这应该是可行的。

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航