Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 运行一个特定的<;脚本>;(Dreamweaver)_Javascript_Html_Dreamweaver - Fatal编程技术网

Javascript 运行一个特定的<;脚本>;(Dreamweaver)

Javascript 运行一个特定的<;脚本>;(Dreamweaver),javascript,html,dreamweaver,Javascript,Html,Dreamweaver,我正在使用Dreamweaver(CC 2015)为学校创建一个网站,我正在使用标签中的JavaScript来更改当你点击另一个文本体时文本的颜色。我想要它,所以只有一个特定的脚本运行,以改变只有一个正文的文本,但当它连续运行时,它只会改变最后一个,无论我点击哪一个。下面是我正在使用的代码 <script> function changeColor(NES) {document.getElementById('NES').style.color = "rgba(229,6,10,1

我正在使用Dreamweaver(CC 2015)为学校创建一个网站,我正在使用标签中的JavaScript来更改当你点击另一个文本体时文本的颜色。我想要它,所以只有一个特定的脚本运行,以改变只有一个正文的文本,但当它连续运行时,它只会改变最后一个,无论我点击哪一个。下面是我正在使用的代码

<script>
function changeColor(NES)

{document.getElementById('NES').style.color = "rgba(229,6,10,1.00)"; }

</script>

<script>
function changeColor(SES)

{document.getElementById('SES').style.color = "rgba(229,6,10,1.00)";}

</script>

<script>
function changeColor(GB)

{document.getElementById('GB').style.color = "rgba(229,6,10,1.00)";}

</script>

功能更改颜色(NES)
{document.getElementById('NES').style.color=“rgba(229,6,10,1.00)”;}
功能更改颜色(SES)
{document.getElementById('SES').style.color=“rgba(229,6,10,1.00)”;}
功能更改颜色(GB)
{document.getElementById('GB').style.color=“rgba(229,6,10,1.00)”;}
以及

<a href="#" onclick="changeColor(NES); return false;">NES</a>

<a href="#" onclick="changeColor(SES); return false;">Super NES </a>

<a href="#" onclick="changeColor(GB); return false;">Game Boy</a>


功能更改颜色(div)
{
div.style.color=“rgba(229,6,10,1.00)”;
}

我不想更改我正在单击的内容的颜色,我想在单击它时更改其他内容的颜色,因此按id获取元素。函数changeColor(div){if(div='NES'){document.getElementById(div).style.color=“rgba(229,6,10,1.00)”;}if(div='NES1'){document.getElementById(div).style.color=“rgba(127,7,6,1.00)”;}if(div==“NES2”){document.getElementById(div).style.color=“rgba(240,8,0,1.00)”;}}还有一种方法可以对特定类执行此操作吗?
<script>
function changeColor(div)
{
    div.style.color = "rgba(229,6,10,1.00)"; 
}
</script>

<a href="#" onclick="changeColor(this);">NES</a>

<a href="#" onclick="changeColor(this);">Super NES </a>

<a href="#" onclick="changeColor(this);">Game Boy</a>