Foros del Web » Programando para Internet » Javascript »

Firefox no ejecuta bien Javascript

Estas en el tema de Firefox no ejecuta bien Javascript en el foro de Javascript en Foros del Web. Hola a todos, Estaba viendo unos tutoriales para crear un bbcode y decidi hacerlo, ya heco lo estaba calando en los diferentes navegadores web y ...
  #1 (permalink)  
Antiguo 08/07/2010, 18:33
 
Fecha de Ingreso: julio-2010
Mensajes: 13
Antigüedad: 13 años, 9 meses
Puntos: 0
Firefox no ejecuta bien Javascript

Hola a todos, Estaba viendo unos tutoriales para crear un bbcode y decidi hacerlo, ya heco lo estaba calando en los diferentes navegadores web y funciona perfecto en IE8, Chrome 5 y Opera 10.
Pero cuando lo cale con Firefox 3.6 resulta que no funcionan los botones para agregar las etiquetas y si le pongo en consola de errores me dice que no estan definidas las funciones pero si lo estan espero que alguien me pueda ayudar.

el form esta asi

Código HTML:
<form name="form2" method="post" action="index.php">
      <p>
        <input name="Submit" type="button" class="b" onClick="instag('b')" value="B">
        <input name="Submit3" type="button" class="u" onClick="instag('u')" value="U">
        <input name="Submit4" type="button" class="i" onClick="instag('i')" value=" I ">
        <input name="Submit" type="button" onClick="instag('img')" value="Img">
        <input name="Submit" type="button" onClick="inslink()" value="Link">
        <input name="Submit4" type="button" class="red" onClick="instag('red')" value=" Red ">
        <input name="Submit4" type="button" class="blue" onClick="instag('blue')" value=" Blue ">
        <input name="Submit4" type="button" class="green" onClick="instag('green')" value=" Green ">
        <input name="Submit4" type="button" class="orange" onClick="instag('orange')" value="Orange">
        <br>
        <textarea name="contenido" cols="53" rows="20" id="contenido"></textarea>
      </p>
      <p>
        <label>
          <input name="comentar" type="submit" class="gigante" id="comentar" value="Comentar">	 
          </label>
      </p>
  </form> 
que al aplanar un boton manda llamar este escript:

Código Javascript:
Ver original
  1. // BBCode
  2. function instag(tag){
  3. var input = document.form2.contenido;
  4. if(typeof document.selection != 'undefined' && document.selection) {
  5. var str = document.selection.createRange().text;
  6. input.focus();
  7. var sel = document.selection.createRange();
  8. sel.text = "[" + tag + "]" + str + "[/" +tag+ "]";
  9. sel.select();
  10. return;
  11. }
  12. else if(typeof input.selectionStart != 'undefined'){
  13. var start = input.selectionStart;
  14. var end = input.selectionEnd;
  15. var insText = input.value.substring(start, end);
  16. input.value = input.value.substr(0, start) + '['+tag+']' + insText + '[/'+tag+']'+ input.value.substr(end);
  17. input.focus();
  18. input.setSelectionRange(start+2+tag.length+insText.length+3+tag.length,start+2+tag.length+insText.length+3+tag.length);
  19. return;
  20. }
  21. else{
  22. input.value+=' ['+tag+']Reemplace este texto[/'+tag+']';
  23. return;
  24. }
  25. }
  26. function insmiley(mili){
  27. var input = document.form2.contenido;
  28. if(typeof document.selection != 'undefined' && document.selection) {
  29. var str = document.selection.createRange().text;
  30. input.focus();
  31. var sel = document.selection.createRange();
  32. sel.text = mili;
  33. sel.select();
  34. return;
  35. }
  36. else if(typeof input.selectionStart != 'undefined'){
  37. var start = input.selectionStart;
  38. var end = input.selectionEnd;
  39. var insText = input.value.substring(start, end);
  40. input.value = input.value.substr(0, start) +mili+ input.value.substr(end);
  41. input.focus();
  42. input.setSelectionRange(start+2+tag.length+insText.length+3+tag.length,start+2+tag.length+insText.length+3+tag.length);
  43. return;
  44. }
  45. else{
  46. input.value+=mili;
  47. return;
  48. }
  49. }
  50. function inslink(){
  51. var input = document.form2.contenido;
  52. if(typeof document.selection != 'undefined' && document.selection) {
  53. var str = document.selection.createRange().text;
  54. input.focus();
  55. var my_link = prompt("Enter URL:","http://");
  56. if (my_link != null) {
  57. if(str.length==0){
  58. str=my_link;
  59. }
  60. var sel = document.selection.createRange();
  61. sel.text = "[web=" + my_link + "]" + str + "[/web]";
  62. sel.select();
  63. }
  64. return;
  65. }else if(typeof input.selectionStart != 'undefined'){
  66. var start = input.selectionStart;
  67. var end = input.selectionEnd;
  68. var insText = input.value.substring(start, end);
  69. var my_link = prompt("Enter URL:","http://");
  70. if (my_link != null) {
  71. if(insText.length==0){
  72. insText=my_link;
  73. }
  74. input.value = input.value.substr(0, start) +"[web=" + my_link +"]" + insText + "[/web]"+ input.value.substr(end);
  75. input.focus();
  76. input.setSelectionRange(start+11+my_link.length+insText.length+4,start+11+my_link.length+insText.length+4);
  77. }
  78. return;
  79. }else{
  80. var my_link = prompt("Ingresar URL:","http://");
  81. var my_text = prompt("Ingresar el texto del link:","");
  82. input.value+="[web=" + my_link + "]" + my_text + "[/web]";
  83. return;
  84. }
  85. }


No se que sea lo que esta pasando porque solo en firefox no funciona

agradesco sus respuestas y si quieren provar la pagina es esta: http://chacharasweb.eshost.com.ar/bbcode/

Última edición por cesarms89; 08/07/2010 a las 21:11
  #2 (permalink)  
Antiguo 08/07/2010, 20:27
Avatar de zerokilled
Javascripter
 
Fecha de Ingreso: abril-2009
Ubicación: Isla del Encanto, La Borinqueña [+>==]
Mensajes: 8.050
Antigüedad: 15 años
Puntos: 1485
Respuesta: Firefox no ejecuta bien Javascript

una cosa tan estúpida lo caga todo. fijate en el valor del atributo type en el elemento script. y por favor, la próxima vez no repitas más de una vez el mismo tema.
__________________
la maldad es una virtud humana,
y la espiritualidad es la lucha del hombre contra su maldad.
  #3 (permalink)  
Antiguo 08/07/2010, 21:04
 
Fecha de Ingreso: julio-2010
Mensajes: 13
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: Firefox no ejecuta bien Javascript

muchas gracias por tu comentario, no puede ser que por una simple palabra estubiera batallando tanto.

yo tenia esto:

Código HTML:
<script language="javascript" type="text/jscript" src="bbcode.js"> </script> 
y solo era de ponerlo asi:

Código HTML:
<script language="javascript" type="text/javascript" src="bbcode.js"> </script> 
y disculpa sobre eso de postear doble no lo volvere a hacer .

Última edición por cesarms89; 08/07/2010 a las 21:12

Etiquetas: firefox
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:26.