Javascript中document.write(函数调用)咋会是这样呢?????
function test_document()
{
document.write("Hello,how are you!");
}
在HTML正文中:
<script>
document.write(test_document())
</script>
结果:
Hello,how are you!undefined
后面的undefined是怎么回事啊?求解释?
[解决办法]
<script type="text/javascript">
function test_document()
{
document.write("Hello,how are you!");
return ""
}
</script>
<script>
document.write(test_document())
</script>
------
因为这个函数没有返回值