2015-04-02 61 views

回答

4

您不會從test函數返回值,從而使testcheck變量undefined

test()呼叫先寫入文件的名稱,然後document.write(testcheck);增加undefined後面。

你會從功能需要returnname

function test() { 
    document.write(name); 
    return name; 
} 

有沒有必要document.write兩次。請將其保留在功能中,或將其從功能中刪除並使用document.write(testcheck);

相關問題