我为我的博主博客创建了我的第一个 Hello World 风格的 Google Gadget,并且为周围 iframe 的背景是白色而苦苦挣扎。我无法从皮肤设置中将其设置为透明,也无法将 CSS 添加到我的代码中,如下所示:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="hello world example" />
<Content type="html">
<![CDATA[
<div id="countdown"></div>
<script type="text/javascript">
// Get userprefs
var element = document.getElementById('countdown');
var text = '';
var today = new Date();
var BigDay = new Date("March 8, 2013");
var msPerDay = 24 * 60 * 60 * 1000;
var timeLeft = (BigDay.getTime() - today.getTime());
var e_daysLeft = timeLeft / msPerDay;
var daysLeft = Math.floor(e_daysLeft);
var e_hrsLeft = (e_daysLeft - daysLeft)*24;
var hrsLeft = Math.floor(e_hrsLeft);
var minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
element.innerHTML = text + '<span class="number">' + daysLeft + '</span>';
</script>
<style rel="text/css">
body {
background-color: transparent !important;
}
#countdown {
text-align: center;
font-size: 60px;
}
</style>
]]>
</Content>
</Module>