<script>
var setFontColor=new Function("x","document.fgColor=x");
/*
函数对象,相当于
function setFontColor(x)
{
document.fgColor=x;
}
*/
</script>
<body>
Are you like color:<br>
<form name="form1">
<input type="button" value="red" name="redButton" onClick=setFontColor("red")>
<input type="button" value="blue" name="blueButton" onClick=setFontColor("blue")>
</form>
</body>
var setFontColor=new Function("x","document.fgColor=x");
/*
函数对象,相当于
function setFontColor(x)
{
document.fgColor=x;
}
*/
</script>
<body>
Are you like color:<br>
<form name="form1">
<input type="button" value="red" name="redButton" onClick=setFontColor("red")>
<input type="button" value="blue" name="blueButton" onClick=setFontColor("blue")>
</form>
</body>