Não há problema em usar a função de acabamento do JavaScript em Firefox
<Script Language = "JavaScript"> var test1 = "AA"; test1 = test1.toString (); test1 = test1.trim (); </script>
Não há problema em usar isso no Firefox, mas será relatado no IE.
Então podemos modificar
String.prototype.trim = function () {return this.replace (/(^/s*) | (/s*$)/g, "");}Adicione esta frase na cabeça e o acima pode ser executado no IE e no FF.
<Script Language = "javascript"> string.prototype.trim = function () {return this.replace (/(^/s*) | (/s*$)/g, "");} var test1 = "aa"; test1 = test1.toString (); test1 = test1.trim (); </script>Métodos fornecidos pela JQuery:
<! Doctype html> <html> <head> <script src = "http://code.jquery.com/jquery-latest.js"> </script> </head> <body> <butter> Mostrar exemplo </button> <cript> $ (""). "'"); </script> </body> </html>