The following function sets the following error: "uncaught typeerror undefined is not a function javascript" worked fine before , now fails =( Helpme please!
$('longitud-grados').addEvent('change', function(event){
var lg = $('longitud-grados').value;
var lm = $('longitud-minutos').value;
var ls = $('longitud-segundos').value;
if((lg > 117) || (lg < 86)) $('longitud-grados').value = '';
if(lg != '' && lm != '' && ls != ''){
c = new Coordenada();
l = c.gms2dec(lg, lm, ls, 'w');
$('longitud').value = l.decimal;
}
});
this is because $ is not defined. I had a look at your web page
> $('longitud-grados').
Uncaught SyntaxError: Unexpected token } VM1196:732
> $('longitud-grados')
Uncaught TypeError: undefined is not a function VM1555:2
> $
undefined
> MooTools
Object {version: "1.4.5", build: "ab8ea8824dc3b24b6666867a2c4ed58ebb762cf0", More: Object, lang: Object}
> document.id
function (D,F,E){if(D&&D.$family&&D.uniqueNumber){return D;}var l=typeOf(D);return(e[l])?e[l](D,F,E||document):null;}
So, for whatever reason, your $ is not defined - either do $ = document.id;
or change your script to use document.id('longitud-grados');
you can also use a closure pattern around that code like
(function($){
...
$('someid'); // will work
}(document.id));
keep in mind you also have jQuery
on the page, doing $ = document.id
may cause problems with your jQuery scripts if it's not using .noConflict()
mode
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.