Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 1.18 KB  |  hits: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Uppercase first letter of a string chrashes in IE7
  2. actualizarTituloWeb('brand name - '+seccion.toLowerCase().replace(/(?:_| |b)(w)/g, function(str, p1) { return p1.toUpperCase()}));
  3.        
  4. function actualizarTituloWeb(titulo){
  5.         $( 'title' ).html ( titulo );  
  6. }
  7.        
  8. function actualizarTituloWeb(titulo){
  9.  
  10.         titulo = titulo[0].toUpperCase() + titulo.substring(1);
  11.  
  12.             titulo = titulo.toLowerCase();
  13.  
  14.             $( 'title' ).text ( titulo );
  15.  
  16.         return false;
  17. }
  18.        
  19. titulo = titulo[0].toUpperCase() + titulo.substring(1);
  20.        
  21. titulo = titulo.charAt(0).toUpperCase() + titulo.substring(1);
  22.        
  23. <html>
  24. <head>
  25.     <title>test</title>
  26. </head>
  27. <body>
  28.     <script type='text/javascript'>
  29. document.getElementsByTagName('title')[ 0 ].firstChild // null in IE <= 8
  30.                                                        // IE 9 (and other browser): text node with nodeValue 'test'
  31.     </script>
  32. </body>
  33. </html>
  34.        
  35. document.title = titulo;
  36.        
  37. actualizarTituloWeb('brand name - ' + seccion.toLowerCase().replace(/(^|s|-)(.)/gi, function(c) { return c.toUpperCase()}));
  38.        
  39. var str = "blah blah";
  40. str = str.toLowerCase();
  41. str = str[0].toUpperCase() + str.substring(1);
  42. document.title = str;