Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/466.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用getInnerHtml自定义信息框_Javascript_Google Maps_Google Maps Api 3 - Fatal编程技术网

Javascript 使用getInnerHtml自定义信息框

Javascript 使用getInnerHtml自定义信息框,javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,有没有人对谷歌地图api V3的infobox有一些经验 属性内容可以在html Dom模式下采用纯html和或文本。 所以我想我正在用纯html构建自己的信息窗口,就像这样 function getInnerHtml( name, contract, detailLink) { var innerHtml = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/

有没有人对谷歌地图api V3的infobox有一些经验

属性内容可以在html Dom模式下采用纯html和或文本。 所以我想我正在用纯html构建自己的信息窗口,就像这样

 function getInnerHtml( name, contract, detailLink)
    {
    var innerHtml = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' + 
                            '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl">'+ 
                            '<head>'+  '<title>Framed</title>' + '<style>' +
                            '.infoLayer img {  border: none; }' + 
                            '.infoLayer { height: 83px; overflow: hidden; display: inline-block; min-width: 205px;' +
                            '.infoLayer .content { background: url(img/bg-info-layer.png) repeat-x 0 0; height: 49px; margin: 0; padding: 10px 0; overflow: hidden; float: left;' +
                            '.infoLayer .bgLeft {  background: url(img/bg-info-layer-left.png) no-repeat left top; height: 69px; width: 11px; float: left; }' + 
                            '.infoLayer a, .infoLayer a:active,  .infoLayer a:visited { color: #fff; text-decoration: none;  } }' +
                            '.infoLayer h3 {  margin: 0; padding: 0 10px 0 0; font-size: 16px;  font-weight: bold; }' +
                            '.infoLayer .bgRight { float: left; width: 31px; }' +
                            '.infoLayer .bgRight img { display: block;  overflow: hidden; }' +
                            '.infoLayer .content p {  margin: 0;  padding: 0 10px 0 0;  font-size: 12px;' +
                            '.infoLayer .bottom {  clear: both;  height: 14px;  font-size: 1px;  line-height: 1px;  text-align: center; overflow: hidden; }' +
                            ' </style>' + '</head><body>' + 
                            ' <div class="infoLayer">' + '<div class="wrapper">' + '<div class="bgLeft"></div>' + '<div class="content" style="">'  +  '<h3><a href="#">' + name + '/a></h3>' +
                            ' <p><a href="#">'+ vergoeding(contract) +'</a></p>' + '</div>' + '<div class="bgRight"><a href="#"><img src="../../Content/green_arrow.png" alt="pijl" width="31" height="69" /></a></div>' +
                            '</div>' + ' <div class="bottom"><img src="img/arrow-info-layer-bottom.png" alt="" width="29" height="14"></div>' + ' </div>' + '</body>' + '</html>';
    return innerHtml;

}



   function boxText(name, contract, vestigingID)
    {
        var detailLink =  getBaseUrl() + "/Details/" + vestigingID;
        var boxText = document.createElement("html");
           boxText.innerHTML = getInnerHtml(name, contact, detailLink);

        return boxText;
    }

 function infoboxOptions(boxText)
    {
     var Options = {
             content: boxText
            ,disableAutoPan: false
            ,maxWidth: 0
            ,pixelOffset: new google.maps.Size(-140, 0)
            ,zIndex: null
            ,infoBoxClearance: new google.maps.Size(1, 1)
            ,isHidden: false
            ,pane: "floatPane"
            ,enableEventPropagation: false,
            alignBottom: false            
        };
        return Options;
    }
函数getInnerHtml(名称、合同、详细链接) { var innerHtml=''+ ''+ “+”框架“+”+ '.infoLayer img{border:none;}'+ '.infoLayer{高度:83px;溢出:隐藏;显示:内联块;最小宽度:205px;'+ '.infoLayer.content{background:url(img/bg info layer.png)repeat-x 0 0;高度:49px;边距:0;填充:10px 0;溢出:隐藏;浮动:左;'+ '.infoLayer.bgleet{background:url(img/bg info layer left.png)不重复左上角;高度:69px;宽度:11px;浮点:左;}'+ “.infoLayer a、.infoLayer a:活动,.infoLayer a:已访问{color:#fff;文本装饰:无;}”+ “.infoLayer h3{边距:0;填充:0 10px 0;字体大小:16px;字体重量:粗体;}”+ “.infoLayer.bgRight{float:left;width:31px;}”+ “.infoLayer.bgRight img{display:block;overflow:hidden;}”+ '.infoLayer.content p{margin:0;padding:0 10px 0;font size:12px;'+ “.infoLayer.bottom{clear:两者;高度:14px;字体大小:1px;行高:1px;文本对齐:居中;溢出:隐藏;}”+ ' ' + '' + “+”+“+”+“+”+”

“+”+”+ '' + ' ' + ' ' + '' + ''; 返回innerHtml; } 功能框文本(名称、合同、归属ID) { var detailLink=getBaseUrl()+“/Details/”+vestingingid; var-boxText=document.createElement(“html”); boxText.innerHTML=getInnerHtml(姓名、联系人、详细链接); 返回文本框; } 功能infoboxOptions(boxText) { 变量选项={ 内容:boxText ,disableAutoPan:false ,最大宽度:0 ,pixelOffset:new google.maps.Size(-140,0) ,zIndex:null ,infoBoxClearance:newgoogle.maps.Size(1,1) ,isHidden:错 ,窗格:“浮动窗格” ,enableEventPropagation:false, 底部对齐:错误 }; 返回选项; } 我会得到一个定制的信息窗口。 然而,这失败了,我得到了一个信息窗口与错误的东西。 我很抱歉,我遗漏了一些东西。 此外,我喜欢我的信息箱(窗口)在顶部,但我必须俯瞰酒店,有什么想法吗


我真的需要一些帮助。

事实证明,我的样式设计确实有些古怪。所以我决定只使用html标记中的所有属性。

您正在创建“
”(
document.createElement('html')
)节点,并添加另一个“
”(在
getInnerHtml
函数中)在它里面!所以我应该省去它(我的html标签),嗯,好吧,我会试试,谢谢你的回答。我想,你是想把你所有的信息内容都包装在“
iframe
”里面。这很奇怪,因为我用一小段html测试了它,然后它就工作了,所以我想我的样式没有起作用。