下面这段代码执行以后,为什么border变成了11,不是2?如果想达到2的效果应该怎么写?
<script>
function displayResult()
{
document.getElementById("p1").style.cssText="border:"+1+1+"px dashed green;color:red";
}
</script>
<p id="p1" style="border:1px dashed green;color:red;">This is a paragraph.</p>
<br>
<button type="button" onclick="displayResult()">Get the style declaration as a string</button>