<html>
<div id="div1" style="border:1px solid" onclick="change()">
aaa
</div>
</html>
<?php
/*echo 'php输出:';
echo "<script>document.write(document.getElementById('div1').style)</script>";
echo '<hr>';*/
?>
<script>
function change()
{
document.getElementById('div1').style = "border:5px solid";
}
</script>
<div id="div1" style="border:1px solid" onclick="change()">
aaa
</div>
</html>
<?php
/*echo 'php输出:';
echo "<script>document.write(document.getElementById('div1').style)</script>";
echo '<hr>';*/
?>
<script>
function change()
{
document.getElementById('div1').style = "border:5px solid";
}
</script>
<html>
<div id="div1" style="border:1px solid" onclick="change()">
aaa
</div>
</html>
<script>
function change()
{
alert('test');
document.getElementById('div1').style.border = "5px solid";
alert('test2');
alert(document.getElementById('div1').style);
alert(document.getElementById('div1').style.border);
}
</script>
document.getElementById('div1').style.borderStyle = "solid";
document.getElementById('div1').style.borderColor = "red";
{
document.getElementById('div1').cssText= "border:5px solid red";
}
{
document.getElementById('div1').style.cssText= "border:5px solid red";
}少写了style