关于在DREAMWEAVER里调用JAVASCRIPT的问题

来源:百度知道 编辑:UC知道 时间:2024/05/13 10:35:14
<td onclick="MM_callJS('this.bgColor=\"red\");')"> </td>

<td onmouseover="this.bgColor='red'" onmouseout="this.bgColor='white'"> </td>

第一句就是不执行,第二句顺利执行。我在添加JAVASCRIPT脚本时打的是:this.bgcolor="red"
第一句话换成调用FUNCTION函数同样如此。但是和FUCTION函数本身无关,因为我在函数里写ALERT语句是顺利执行的,就是颜色没有变。
第一句话括号里若改成ALERT语句倒也顺利执行。看样子是颜色部分的有问题。但是第二句能顺利执行的。

楼下的方法还是不行。和我以前一样

不用MM_callJS是可以的。THIS.BGCOLOR=RED都可以。就是使用了“调用JAVASCRIPT”后写代码不行。

//这样颜色没变吗???
<table>
<tr>
<td onmouseover="this.style.backgroundColor='red'" onmouseout="this.style.backgroundColor='white'">asdf </td></tr></table>
++++++++++++++++++++++++++++++++++++

这样去写.
<SCRIPT LANGUAGE="JavaScript">
<!--

function MM_callJS(obj,str)
{
obj.style.backgroundColor=str
}
//-->
</SCRIPT>

<TABLE>
<TR>
<td onmouseover="MM_callJS(this,'red')"> asdfasd</td>
</TR>
</TABLE>