我正在尝试打开一个新的 URL 作为弹出窗口。这样可行。现在我正在尝试从弹出窗口中自定义样式等。那是行不通的。怎么了?
异常:“未捕获的类型错误:无法读取 null 的属性‘样式’”
<script>
function startGaLandingpage(url) {
params = 'width=' + screen.width;
params += ', height=' + screen.height;
params += ', top=0, left=0'
params += ', fullscreen=yes';
var url = 'https://www.google.com/analytics/web/?hl=en&pli=1#realtime/rt-overview/a29259688w55318706p63647373/'
landingpage = window.open(url, 'landingpage', params);
var landingpagescript = document.createElement('script');
landingpagescript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js';
landingpagescript.type = 'text/javascript';
landingpage.document.getElementsByTagName('head')[0].appendChild(landingpagescript);
var div = landingpage.document.getElementById('ID-navPanelContainer').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-headerPanel').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-overviewPanelTrafficSourceValueOrganicTable').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-overviewPanelGeoComponent').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-footerPanel').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-navToggle').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-overtimePanel').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-contextDetailsPanel').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-reportHeader').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
var div = landingpage.document.getElementById('ID-realtimeReportFootnote').style;
if (div)
void (div.display = (div.display == 'none') ? 'block' : 'none');
}
</script>