var points= [
{p:img_uhr,x:3509103.178,y:5425187.344},
{p:img_uhr,x:3509123.178,y:5425187.344},
{p:img_krankhaus,x:3509143.178,y:5425187.344},
{p:img_uhr,x:3509163.178,y:5425187.344},
{p:img_uhr,x:3509183.178,y:5425187.344}
]
我有上面数组,想让他作为method="ws.i.pin.set();"参数,在执行set:function (),<Tool id="pintest2" img="pan.gif" use="true" method="ws.i.pin.set();" />set:function () {img.src =points[i].p;
img_width=img.width;
img_height=img.height;
// Pixel diff from left upper
xp[i] = (points[i].x  - lux) / ws.map.scale;
yp[i] = (luy - points[i].y) / ws.map.scale; }多谢!

解决方案 »

  1.   

    <Tool id="pintest2" img="pan.gif" use="true" method="ws.i.pin.set(points);" /> set:function (e) { 
       alert(e[0].p);
    }
      

  2.   

    <Tool id="pintest2" img="pan.gif" use="true" method="function(){ws.i.pin.set(points);}" /> 假定已经有全局的points变量
      

  3.   

    想问一下,我这一大串数组该放到html中还是js中
      

  4.   

    放在html的scripts标签里
    比如:
    <html>
      <head>
        <script>
          var data = {
            points:<%= Points.data %>
          }
          data.points     //调用数组
        </script>
      </head>
    </html>
      

  5.   

    <Tool id="pintest2" img="pan.gif" use="true" method="ws.i.pin.set(points);"  />
    是在jsp文件中,请楼上再帮我详细写一下好吗,谢谢!
      

  6.   

    jsp文件<Toolbar use="true" default_tool="" halign="center" inactive_size="20" active_size="10" proximity="20">
    <Tool id="zoomin"></Tool>
    <Tool id="zoomout"></Tool>
    <Tool id="plus"></Tool>
    <Tool id="minus"></Tool>
    <Tool id="pan"></Tool>
    <Tool id="home"></Tool>
    <Tool id="undo"></Tool>
    <Tool id="redo"></Tool>
    <Tool id="identify" use="false"></Tool>
    <Tool id="selectRect" use="false"></Tool>
    <Tool id="selectPolygon" use="false"></Tool>
    <Tool id="selectCircle" use="false"></Tool>
    <Tool id="pintest" img="loeschen.gif" use="true" method="ws.i.pin.clear();" />
    <Tool id="pintest2" img="pan.gif" use="true" method="ws.i.pin.set(points);"  />
    </Toolbar>
      

  7.   

    f([])  haoxij好像就是这么简单 什么都不用  js出了大小写要求比较严格外 其他的基本都没有什么要求