首页 \ 问答 \ Google地球插件忽略的KML中的JavaScript(JavaScript In KML Ignored By Google Earth Plugin)

Google地球插件忽略的KML中的JavaScript(JavaScript In KML Ignored By Google Earth Plugin)

我创建了一个简单的KML文件,可以在独立的Google地球客户端中运行,但在Google地球插件中无论如何都不起作用(无论浏览器如何):

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
    <Folder>
        <name>South Florida</name>
        <open>1</open>
        <Document>
            <name>Miami</name>
            <Style id="miami_style">
                <IconStyle>
                    <Icon>
                        <href>http://i.imgur.com/CNrRU.gif</href>
                    </Icon>
                </IconStyle>
                <BalloonStyle>
                    <text><![CDATA[<font face="Arial">$[description]</font>]]></text>
                </BalloonStyle>
            </Style>
            <Folder>
                <name>Miami</name>
                <open>1</open>
                <Placemark id="Miami">
                    <name>Miami</name>
                    <description><![CDATA[
                        <script type="text/javascript">
                            function hideImage() {
                                var image = document.getElementById("image");
                                image.style.opacity = 0;
                                image.style.MozOpacity = 0;
                                image.style.KhtmlOpacity = 0;
                                image.filter = "alpha(opacity=0)";
                            }
                        </script>
                        <button id='clicker' onclick='hideImage();'>Click Me</button>
                        <img id="image" src="http://i.imgur.com/4rhT7.png">
                    ]]></description>
                    <styleUrl>#miami_style</styleUrl>
                    <Point>
                        <coordinates>-80.22643611111111,25.788952777777777,0</coordinates>
                    </Point>
                </Placemark>
            </Folder>
        </Document>
    </Folder>
</kml>

基本上,我有一个默认显示的图像,当我点击按钮时,我想让它消失。 最终,我希望能够通过点击切换图像,但我认为这需要首先工作才能达到这一步。

这在独立的Google地球中完美运行,但在Google地球插件中不起作用。

奇怪的是,如果我在显示气球在JavaScript控制台中运行它,这也适用于Google地球插件。 它只是不承认文件中已存在的代码。

有任何想法吗?


I've created a simple KML file that works in the standalone Google Earth client, but won't work at all in the Google Earth Plugin (regardless of browser):

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
    <Folder>
        <name>South Florida</name>
        <open>1</open>
        <Document>
            <name>Miami</name>
            <Style id="miami_style">
                <IconStyle>
                    <Icon>
                        <href>http://i.imgur.com/CNrRU.gif</href>
                    </Icon>
                </IconStyle>
                <BalloonStyle>
                    <text><![CDATA[<font face="Arial">$[description]</font>]]></text>
                </BalloonStyle>
            </Style>
            <Folder>
                <name>Miami</name>
                <open>1</open>
                <Placemark id="Miami">
                    <name>Miami</name>
                    <description><![CDATA[
                        <script type="text/javascript">
                            function hideImage() {
                                var image = document.getElementById("image");
                                image.style.opacity = 0;
                                image.style.MozOpacity = 0;
                                image.style.KhtmlOpacity = 0;
                                image.filter = "alpha(opacity=0)";
                            }
                        </script>
                        <button id='clicker' onclick='hideImage();'>Click Me</button>
                        <img id="image" src="http://i.imgur.com/4rhT7.png">
                    ]]></description>
                    <styleUrl>#miami_style</styleUrl>
                    <Point>
                        <coordinates>-80.22643611111111,25.788952777777777,0</coordinates>
                    </Point>
                </Placemark>
            </Folder>
        </Document>
    </Folder>
</kml>

Basically, I have an image that displays by default, and I want to make it go away when I click the button. Eventually, I want to be able to toggle images by clicking, but I figure this needs to work first in order to get to that step.

This works perfectly fine in standalone Google Earth, but doesn't work in the Google Earth Plugin.

Oddly, this also works in the Google Earth Plugin if I run it in a JavaScript console after the balloon is already displayed. It just doesn't acknowledge the code already in the file.

Any ideas?


原文:https://stackoverflow.com/questions/8153120
更新时间:2023-04-16 20:04

最满意答案

SELECT DISTINCT e.ssn, e.lname, e.fname
FROM employee e,
  (SELECT mgrssn AS mgrssn
    FROM department
  UNION
  SELECT superssn AS mgrssn
    FROM employee) m
  WHERE e.ssn = m.mgrssn;

应该管用。

我不确定外部联接或GROUP BY如何在这里为您服务; 一个表从一个表中返回第二个表中没有相应行的行,而另一个表用于通过聚合函数将多个行压缩为一个。

我也不确定是什么

2)因为我使用两个empoyees,一个导师告诉我,我可以使用employee1和employee2来区分它们,是吗? 反正有没有使用两名员工身份证明?

手段。 您可以使用employee1employee2作为employee2 别名 ,这将允许您对同一个表进行多个独立引用,但是无论您使用多少别名,数据库中仍然只有一个employee表。


SELECT DISTINCT e.ssn, e.lname, e.fname
FROM employee e,
  (SELECT mgrssn AS mgrssn
    FROM department
  UNION
  SELECT superssn AS mgrssn
    FROM employee) m
  WHERE e.ssn = m.mgrssn;

should work.

I'm not sure how either an outer join or a GROUP BY would serve you here; one returns rows from one table which have no corresponding row in a second table, while the other is used for condensing multiple rows into one via aggregate functions.

I'm also not sure what

2) Also since I use two empoyees, one tutor told me I can use employee1 and employee2 to differentiate them, is that right? Are there anyways not using two employees identification?

means. You could use employee1 and employee2 as aliases for employee, which would allow you to make multiple independent references to the same table, but however many aliases you use, there's still only one employee table in the database.

相关问答

更多
  • LEFT JOIN是一个好主意。 但是,您希望委托日期在ON子句中。 然后找到不匹配的员工。 所以,这是查询的一个版本(清理使用表别名): SELECT e.EmpId, e.EmpName FROM Employee e LEFT OUTER JOIN Commission c ON e.EmpId = c.EmpId AND c.Commdate BETWEEN '2014-06-01' AND '2014-06-31' WHERE e.JoinDate < '201 ...
  • 有一种方法可以在LINQ中保持连接,但这是真的 - 语法不是那么清楚。 您的查询将如下所示: var query = from year in years join data in myData on year equals (data.Expiration.Year - DateTime.Now.Year) + 1 into year_data from y_d in year_data.Def ...
  • 尝试移动AND P.qty is not null从WHERE子句到连接表达式的AND P.qty is not null 。 Try moving AND P.qty is not null from the WHERE clause to the join expression.
  • 尝试下面的查询, SELECT C.CustomerID, C.CustomerName, L.CalYear, L.CalMonth, Sum(P.Amt) FROM Customers C CROSS JOIN @Cal L LEFT OUTER JOIN Purchases P ON C.CustomerID = P.CustomerID AND L.CalYear = Year(P.Purchas ...
  • 我不太确定你想要达到什么目的? 如果您正在查询每个员工返回一行,并且两个可选列包含经理的信息,那么您的原始查询是正确的(没有分组依据)。 这种关系是多对一的,你从每个“很多”的行开始,每行有一个(可选的)“一”,所以不需要分组。 然而,这假设您的数据是正确的,并且prs_number实际上对每个员工都是唯一的。 如果您有两个或更多经理共享prs_number,您最终将拥有拥有多个经理的人员。 通过使这成为一个外部联接你也返回没有经理的人(即食物链的顶端:)),这是你的意图吗? 编辑 如果您只想要返回经理,那 ...
  • 使用组加入: groupedOccurrences = (from e in db.Employees join o in db.Occurrences.Where(x => x.OccurrenceDate >= beginDate && x.OccurrenceDate <= endDate) ...
  • 我猜你把GROUP BY放在了WHERE之后,这是非法的。 请参阅MySQL中SELECT语法的参考资料 。 尝试这个: SELECT s.id AS id, s.story_date AS datetime, s.story_content AS content, t.story_type_label AS type_label, t.story_type_slug AS type_slug, COUNT(c.id) AS comment_count FRO ...
  • SELECT DISTINCT e.ssn, e.lname, e.fname FROM employee e, (SELECT mgrssn AS mgrssn FROM department UNION SELECT superssn AS mgrssn FROM employee) m WHERE e.ssn = m.mgrssn; 应该管用。 我不确定外部联接或GROUP BY如何在这里为您服务; 一个表从一个表中返回第二个表中没有相应行的行,而另一个表用于通过聚合 ...
  • 我想你可能需要走很远的路: SELECT TableA.Type, SUM(b.HreReelles) AS HreReellesTotales, b.NoProjet_Short FROM TableA LEFT JOIN (SELECT * FROM TableB WHERE TableB.ColumnName = 'SomeValue') b ON TableA.IDType = b.IDType WHERE TableA.Categorie = 'Electrique' ...
  • 解决MySQL和Oracle问题的一种方法是使用子查询通过按名称汇总详细信息表中的总和来帮助解决重复问题,这样您就可以使用普通连接进行汇总。 SELECT ts.name, SUM(ts.amt) amt1, MAX(td1.amt) amt2, MAX(td2.amt) amt3 FROM TEST_SUMMARY ts LEFT JOIN ( SELECT ts.name, SUM(td.d_amt) amt FROM TEST_DETAIL td JOIN TEST_SUMMARY ts O ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)