map area 用法示例

基础用法参考:点击查阅文档

代码示例:

    <div>
        <img src="./media/img/1-130Z2000247.jpg" usemap="#areaTest">
        <map name="areaTest" id="areaTest">
            <area shape="circ" coords="50,50,50" id="circ">
            <area shape="rect" coords="100,100,300,300" id="rect">
            <area shape="poly" coords="0,100,50,150,100,200,150,250,100,300,50,350" id="poly">
            <area shape="default" id="default">
        </map>
    </div>
    <!-- <script src="./plugin/vue.js"></script> -->
    <script src="./plugin/jquery-3.1.0.js"></script>
    <script>
        $('#circ').on('click',function() {
            console.log($(this))
            console.log('circ')
        })
        $('#rect').on('click',function() {
            console.log($(this))
            console.log('rect')
        })
        $('#poly').on('click',function() {
            console.log($(this))
            console.log('poly')
        })
        $('#default').on('click',function() {
            console.log($(this))
            console.log('default')
        })
    </script>
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
map<string, map<string, string>> 是一个键为 string 类型,值为 map<string, string> 类型的 map。 这个 map 中的每个元素都是一个键值对,其中键是一个 string 类型的字符串,值是另一个 map<string, string> 类型的 map,这个 map 中的每个元素也是一个键值对,其中键和值都是 string 类型的字符串。 下面是一个使用 map<string, map<string, string>> 的示例: ```cpp #include <iostream> #include <map> using namespace std; int main() { map<string, map<string, string>> countries; // 添加元素 countries["China"]["capital"] = "Beijing"; countries["China"]["population"] = "1.4 billion"; countries["USA"]["capital"] = "Washington D.C."; countries["USA"]["population"] = "328 million"; countries["Japan"]["capital"] = "Tokyo"; countries["Japan"]["population"] = "126 million"; // 遍历元素 for (auto iter = countries.begin(); iter != countries.end(); iter++) { cout << iter->first << ":" << endl; for (auto sub_iter = iter->second.begin(); sub_iter != iter->second.end(); sub_iter++) { cout << " " << sub_iter->first << " - " << sub_iter->second << endl; } } return 0; } ``` 输出: ``` China: capital - Beijing population - 1.4 billion Japan: capital - Tokyo population - 126 million USA: capital - Washington D.C. population - 328 million ``` 以上代码创建了一个 map<string, map<string, string>> 对象 countries,然后向其中添加了三个元素,每个元素都是一个键值对,其中键是一个 string 类型的字符串,值是另一个 map<string, string> 类型的 map,这个 map 中也是由键值对组成的。 遍历 map 的方法是使用迭代器,先遍历外层的 map,然后再遍历内层的 map,输出每个元素的键和值。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

定栓

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值