[Mapserver-users] Problem with access jBox's methods from javascripts functions.
TN Jorge Alberto Arocha Muñoz
jorge.arocha at armada.mil.co
Tue Nov 25 12:23:09 PST 2003
I have next problem:
1. Template:
<html>
<head>
....................
<script language="javascript" src="/interface_sig/javascript/sig.js"></script>
</head>
<body>
...........
<img name="zoomin" src="/interface_sig/imagenes/zoomin_nopres.png" onClick="clickboton(this); document.jBox.boxon();">
<img name="pan" src="/interface_sig/imagenes/pan_nopres.png" onClick="clickboton(this); document.jBox.dragon();">
<img name="zoomout" src="/interface_sig/imagenes/zoomout_nopres.png" onClick="clickboton(this); document.jBox.boxoff();">
<img name="medir" src="/interface_sig/imagenes/medir_nopres.png" onClick="clickboton(this); document.jBox.lineon();">
..........
<form method="GET" name="mapserv" action="/cgi-bin/mapserv">
.........
<applet codebase="/interface_sig/jBox" code="jBoxPNG.class" width="578" height="305" name="jBox" MAYSCRIPT>
<param name="image" value="http://[host][img]">
</applet>
...................
</body>
</html>
2. File sig.js
....
function clickboton(objeto) {
activo.src = base + activo.name + '_nopres.png';
activo = objeto;
objeto.src = base + objeto.name + '_pres.png';
switch (activo.name) {
case 'info' :
map_obj.modo = 'nquery';
break;
case 'zoomin' :
map_obj.modo = 'browse';
map_obj.zoomdir = '1';
break;
case 'pan' :
map_obj.modo = 'browse';
map_obj.zoomdir = '0';
break;
case 'zoomout' :
map_obj.modo = 'browse';
map_obj.zoomdir = '-1';
}
}
.......
This way all it's Ok, access jBox's methods work fine, but i want to use only function "clickboton()" at event onClick and try:
1. Supress in the img tag, jBox method:
<img name="zoomin" src="/interface_sig/imagenes/zoomin_nopres.png" onClick="clickboton(this)">
2. Add in file sig.js on function clickboton():
....
function clickboton(objeto) {
activo.src = base + activo.name + '_nopres.png';
activo = objeto;
objeto.src = base + objeto.name + '_pres.png';
switch (activo.name) {
case 'info' :
document.jBox.boxon();
map_obj.modo = 'nquery';
break;
case 'zoomin' :
document.jBox.boxon();
map_obj.modo = 'browse';
map_obj.zoomdir = '1';
break;
case 'pan' :
document.jBox.dragon();
map_obj.modo = 'browse';
map_obj.zoomdir = '0';
break;
case 'zoomout' :
document.jBox.boxoff();
map_obj.modo = 'browse';
map_obj.zoomdir = '-1';
}
}
.......
With these changes the page dosen't work. The javascript debugger display this message: Exception ``TypeError: document.jBox.boxon is not a function'' thrown from function clickboton().
I treated other forms:
* document.applet.jBox.boxon()
* document.applets[0].boxon()
And nothing to do.
Any idea......
Thanks for your help......
More information about the MapServer-users
mailing list