2010-01-18 23 views
1

我在Windows 7中編寫了一個補充工具欄小工具,並添加了g:textObject,稍後通過variable.value更改了該值。Windows小工具字體錯誤

但是,在Windows Vista中運行時,文本似乎會奇怪地壓縮自己。

這段代碼有什麼問題嗎?

var clock = document.getElementById("background").addTextObject("Time", "Nyala", 18, "white", 110, 500); 
//This correctly displays the word 'Time' in the proper font. 

clock.value = clock.value+"s"; 
//This causes the text to become "Times" but shrink. 
//appending more sporadically causes the textObject to shrink as well. 

正在使用.value錯誤的方式來做到這一點?

回答

1

更改文本字符串不會更新g:文本對象的寬度或高度。這是一個已知的問題,爲了兼容性目的可能不會被修復。您必須手動重置寬度和高度更改值:

var clock = document.getElementById("background") 
    .addTextObject("Time", "Nyala", 18, "white", 110, 500); 

// Set the new value and reset the width and height by setting them to 0 
clock.value = clock.value+"s"; 
clock.width = 0; 
clock.height = 0; 
+0

謝謝,我會試試看!順便說一句,這是所有這些記錄在任何地方?我無法讓谷歌指向我在msdn中的正確位置,我認爲它應該是.. – Vanwaril 2010-01-19 16:41:36

+1

許多錯誤以及適用的各自的解決方法可以在http://www.aeroxp.org找到。 /board/index.php?showtopic=7318。不過,這個清單還沒有更新。我認爲,從我自己的測試中,大約18個這些錯誤在Windows 7中得到修復。 – 2010-01-19 17:23:16