Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript]problem ze skryptem, powiekszanie czcionek
noc_nik
post
Post #1





Grupa: Zarejestrowani
Postów: 95
Pomógł: 0
Dołączył: 24.06.2003
Skąd: Kielce

Ostrzeżenie: (0%)
-----


witam
znalazłem taki skrypt do powiekszania czcionek

  1. var min=11;
  2. //var standard=15
  3.  
  4. var max=13;
  5.  
  6. function increaseFontSize() {
  7. var p = document.getElementsByTagName('*');
  8. for(i=0;i<p.length;i++) {
  9. if(p[i].style.fontSize) {
  10. var s = parseInt(p[i].style.fontSize.replace("px",""));
  11. } else {
  12. var s = 11;
  13. }
  14. if(s!=max) {
  15. s += 1;
  16. }
  17. p[i].style.fontSize = s+"px";
  18. }
  19. createCookie('txtsize',s);// added
  20. };
  21.  
  22. /* ORIGINAL
  23. function resetFontSize() {
  24. var p = document.getElementsByTagName('*');
  25. for(i=0;i<p.length;i++) {
  26. p[i].style.fontSize = standard+"px";
  27. }
  28. }; */
  29.  
  30.  
  31. // NY RESET 9/4/08
  32. function resetFontSize() {
  33. var p = document.getElementsByTagName('*');
  34. for(i=0;i<p.length;i++) {
  35. p[i].style.fontSize = "11px";
  36. }
  37. createCookie('txtsize',11);
  38. };
  39.  
  40. function decreaseFontSize() {
  41. var p = document.getElementsByTagName('*');
  42. for(i=0;i<p.length;i++) {
  43. if(p[i].style.fontSize) {
  44. var s = parseInt(p[i].style.fontSize.replace("px",""));
  45. } else {
  46. var s = 11;
  47. }
  48. if(s!=min) {
  49. s -= 1;
  50. }
  51. p[i].style.fontSize = s+"px";
  52. }
  53. createCookie('txtsize',s);// added
  54. };
  55.  
  56.  
  57. /*
  58. added all below
  59. */
  60.  
  61. function createCookie(name,value,days) {
  62. if (days) {
  63. var date = new Date();
  64. date.setTime(date.getTime()+(days*24*60*60*1000));
  65. var expires = "; expires="+date.toGMTString();
  66. }
  67. else var expires = "";
  68. document.cookie = name+"="+value+expires+"; path=/";
  69. }
  70.  
  71. function readCookie(name) {
  72. var nameEQ = name + "=";
  73. var ca = document.cookie.split(';');
  74. for(var i=0;i < ca.length;i++) {
  75. var c = ca[i];
  76. while (c.charAt(0)==' ') c = c.substring(1,c.length);
  77. if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  78. }
  79. return null;
  80. }
  81.  
  82. //window.onload = readCookie
  83. //window.onload = resetFontSize
  84.  
  85. // TESTING
  86.  
  87. window.onload = setUserOptions;
  88.  
  89. function setUserOptions(){
  90. var p = document.getElementsByTagName('*');
  91. for(i=0;i<p.length;i++) {
  92. p[i].style.fontSize = standard+"px";
  93. }
  94.  
  95. }

  1. <a title="-" href="java script:decreaseFontSize()"><img src="gfx/-.png" width="24" height="24" border="0" alt="-"></a>
  2. <a title="+" href="java script:increaseFontSize()"><img src="gfx/+.png" width="24" height="24" border="0" alt="+"></a>



problem polega na tym ze :

1) chce aby ten skrypt powiekszał tylko część do czytania tekstu np:


  1. <br>to jest tekst nie do zmiany
  2. <br>a to jest tekst który bedzie powiększany


dzieki za pomoc i pozdrawiam.


--------------------
:)
Go to the top of the page
+Quote Post
flashdev
post
Post #2





Grupa: Zarejestrowani
Postów: 812
Pomógł: 117
Dołączył: 2.12.2008

Ostrzeżenie: (10%)
X----


  1. [...]
  2. function increaseFontSize(p) {
  3. for(i=0;i<p.length;i++) {
  4. [...]


  1. <a title="-" href="java script:decreaseFontSize(document.getElementsByClassName('resizable'))"><img src="gfx/-.png" width="24" height="24" border="0" alt="-"></a>
  2. <a title="+" href="java script:increaseFontSize()"><img src="gfx/+.png" width="24" height="24" border="0" alt="+"></a>


  1. <br>to jest tekst nie do zmiany
  2. <br><a span class="resizable">a to jest tekst który bedzie powiększany</span>


Kilka prostych zmian i powinno działać.


--------------------
Go to the top of the page
+Quote Post
noc_nik
post
Post #3





Grupa: Zarejestrowani
Postów: 95
Pomógł: 0
Dołączył: 24.06.2003
Skąd: Kielce

Ostrzeżenie: (0%)
-----


Niestety nie działa :[ , albo ja coś powaliłem .
Przetestowałeś to ?


--------------------
:)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 04:28