Modifier fonction javascript

Modifier fonction javascript - HTML/CSS - Programmation

Marsh Posté le 24-06-2013 à 18:14:20    

bonjour tout le monde!

 

je n'y connais malheureusement pas assez en JavaScript pour me débrouiller seul donc je viens vous demander de l'aide :$

 

Voila j'ai trouvé un script de recherche sur internet pour mon site, http://www.pod-online.fr/peint.php
Le visiteur insère le code inscrit sur son carnet "92U" (par exemple) et tombe sur le résultat.
J'aimerai personnaliser le résultat, mais à part rajouter du texte je n'arrive rien à faire d'autre.

 

Je voudrai mettre un lien et un bouton "imprimer" est-ce possible?

 

Lorsqu'on recherche, il y a un appel du fichier "codepeint.txt" qui contient:

Code :
  1. var item = new Array();
  2. // "La page","Son adresse","","Titre de la page","Mot clés","Description de la page"
  3. c=0; item[c]=new Array("","index.php","Index ","index, home, premiere, page, sommaire","Première page de ce site" );
  4. c++; item[c]=new Array("","","","full, J3, 60, 25H, 25K","J3/60/25H/25K Ocean jade/Libell tuerkis Metallic" );
  5. c++; item[c]=new Array("","","","full, Q1","Q1 Pastel Yellow" );
  6. c++; item[c]=new Array("","","","full, Z1","Z1 Glacier White" );
  7. c++; item[c]=new Array("","","","full, 12L, 12M","12M/12L Pastellgelb" );
  8. c++; item[c]=new Array("","","","full, 23F, 22D, 59","22D/23F/59 Slate Gray Metallic" );
  9. c++; item[c]=new Array("","","","full, 22L, 52","22L/52 Oak Green Metallic" );
  10. c++; item[c]=new Array("","","","full, 3AE, 39G","3AE/39G Violet Pearl Metallic" );
  11. c++; item[c]=new Array("","","","full, 3AT, 3AU","3AT/3Au Firnweiss" );
  12. c++; item[c]=new Array("","","","full, 3AR, 3AS, J1","3AR/3AS/J1 Blue turquoise" );
  13. c++; item[c]=new Array("","","","full, 3C7, 347, 55","3C7/347/55 Dark Blue" );
  14. c++; item[c]=new Array("","","","full, 3C8, 37U, 56","3C8/37U/56 Cobalt Blue Metallic" );
  15. c++; item[c]=new Array("","","","full, 37E, 57","37E/57 Violet Blue Metallic" );
  16. c++; item[c]=new Array("","","","full, 39C, 37W","39C/37W Night Blue Metallic" );
  17. c++; item[c]=new Array("","","","full, 39V, 39N","39V/39N Iris Blue Metallic" );
  18. c++; item[c]=new Array("","","","full, 84R, 84S, H8","84R/84S/H8 Arena Red Metallic" );
  19. c++; item[c]=new Array("","","","full, 92E, 92M, A8, 58","92E/92M/A8/58 Polar Silver Metallic" );
  20. c++; item[c]=new Array("","","","full, 92T, 92U","92T/92U Artic Silver Pearl Metallic" );
  21. c++; item[c]=new Array("","","","full, 554, 555","554/554 Paladio Pearl metallic" );
  22. c++; item[c]=new Array("","","","full, L041, L747, L741, A1","L041/L0747/L0741/A1 Black" );
  23. c++; item[c]=new Array("","","","full, L1A8, L1A9","L1A8/L1A9 Orange Red Effect" );
  24. c++; item[c]=new Array("","","","full, L1A9, L1A8","L1A8/L1A9 Orange Red Pearl Metallic (2001-2002)" );
  25. c++; item[c]=new Array("","","","full, L12H, L12G, 12H, 12G, 13G, X4, 50","L12H/L12G/12H/12G/13G/X4/50 Speed Yellow" );
  26. c++; item[c]=new Array("","","","full, L22G","L22G Racing Green Effect" );
  27. c++; item[c]=new Array("","","","full, L22D, L23F","L22D/L23F Slate Gray Schiefer Pearl metallic " );
  28. c++; item[c]=new Array("","","","full, L23F","L23F Slate Grey Effect" );
  29. c++; item[c]=new Array("","","","full, L2A2, L2A1","L2A2/L2A1 Jungle Green Pearl Metallic (2002)" );
  30. c++; item[c]=new Array("","","","full, L2A2, L2A2","L2A1/L2A2 Dschungel Green Metallic (2001)" );
  31. c++; item[c]=new Array("","","","full, 2B4, 22E, 53","2B4/22E/53 Forest Green Metallic" );
  32. c++; item[c]=new Array("","","","full, 2B6, 23I, 51","2B6/23I/51 Wimbleddon Green Metallic" );
  33. c++; item[c]=new Array("","","","full, L2B4","L2B4 Forest Green Effect (à partir de 2007)" );
  34. c++; item[c]=new Array("","","","full, L2B4","L2B4 Tannen Green Effect (Avant 2007)" );
  35. c++; item[c]=new Array("","","","full, L2B5","L2B5 Malachite Green Effect" );
  36. c++; item[c]=new Array("","","","full, L2D8","L2D8 Green" );
  37. c++; item[c]=new Array("","","","full, L3A8, L3A9","L3A8/L3A9 Lapis Blue Effect" );
  38. c++; item[c]=new Array("","","","full, L3A8, L3A9","L3A8/L3A9 Lapis Blue Pearl Metallic (2001-2002)" );
  39. c++; item[c]=new Array("","","","full, L3AY, L3AZ, 3AY, 3AZ","L3AY/L3AZ/3AY/3AZ Ocean Blue Pearl Metallic" );
  40. c++; item[c]=new Array("","","","full, L3AW, F1, 3AW","L3AW/F1/3AW Zenith Blue pearl metallic" );
  41. c++; item[c]=new Array("","","","full, L32B","L32B Segel Blue Effect" );
  42. c++; item[c]=new Array("","","","full, L39C","L39C Night Blue Effect" );
  43. c++; item[c]=new Array("","","","full, L3C8","L3C8 Cobalt Blue Effect" );
  44. c++; item[c]=new Array("","","","full, L40W, L40X, 40w, 40X","L40W/L40X/40W/40X Vesuvio Pearl Metallic" );
  45. c++; item[c]=new Array("","","","full, L554, 555","L554/555 Paladio Pearl Metallic" );
  46. c++; item[c]=new Array("","","","full, L51A","L51A Cream White" );
  47. c++; item[c]=new Array("","","","full, L6A6, L6A7","L6A6/L6A7 Meridian Effect" );
  48. c++; item[c]=new Array("","","","full, L6A7, L6A6","L6A6/L6A7 Meridian Pearl Metallic (2001-2002)" );
  49. c++; item[c]=new Array("","","","full, L6B4, L6B5","L6B4/L6B5 Hellgrau Effect (pearl mettalic pour version 2001-2002)" );
  50. c++; item[c]=new Array("","","","full, L746, L744, 746, 744, Z8","L744/L746/746/744/Z8 Black Pearl Metallic" );
  51. c++; item[c]=new Array("","","","full, L84A","L84A Indian Red" );
  52. c++; item[c]=new Array("","","","full, L8A4","L8A3 Orient Red Pearl Metallic" );
  53. c++; item[c]=new Array("","","","full, L8A7","L8A7 Rubin Red Effect" );
  54. c++; item[c]=new Array("","","","full, L8C6","L8C6 Orange" );
  55. c++; item[c]=new Array("","","","full, L80K, L84A, LM3A, G1, G28, 25, 027","L80K/L84A/LM3A/G1/G28/25/027 Guards Red" );
  56. c++; item[c]=new Array("","","","full, LM3A","LM3A Guards Red" );
  57. c++; item[c]=new Array("","","","full, L9A3, L9A2","L9A2/L9A3 Biarritz Weis" );
  58. c++; item[c]=new Array("","","","full, L92M","L92M Polar Silver Effect" );
  59. c++; item[c]=new Array("","","","full, L92T","L92T Artic Silver Effect" );
  60. c++; item[c]=new Array("","","","full, L92U","L92U Artic Silver Effect" );
  61. c++; item[c]=new Array("","","","full, L92T, L92U, X1","L92T/L92u/X1 Artic Silver Pearl Metallic (2000)" );
  62. c++; item[c]=new Array("","","","full, LB9A","LB9A Carrara White" );
  63. c++; item[c]=new Array("","","","full, LC9Z","LC9Z Basalt Black Effect (Pearl Metallic pour 2002)" );
  64. c++; item[c]=new Array("","","","full, LM2Z","LM2Z Nordic gold Effect" );
  65. c++; item[c]=new Array("","","","full, LM3W","LM3W Cordoba Red Effect" );
  66. c++; item[c]=new Array("","","","full, LM5W","LM5W Lapis Blue Effect" );
  67. c++; item[c]=new Array("","","","full, LM6U","LM6U Olive Green Effect" );
  68. c++; item[c]=new Array("","","","full, LM6W","LM6W Jade Green Effect" );
  69. c++; item[c]=new Array("","","","full, LM6W","LM6W Lago Green Effect (avant 2007)" );
  70. c++; item[c]=new Array("","","","full, LM6X","LM6X Dunkel Olive Green Effect" );
  71. c++; item[c]=new Array("","","","full, LM7W","LM7W Meteor Grey Effect" );
  72. c++; item[c]=new Array("","","","full, LM7X","LM7X Atlas Grey Effect" );
  73. c++; item[c]=new Array("","","","full, LM7Z","LM7Z Silverstone Effect" );
  74. c++; item[c]=new Array("","","","full, LM8W","LM8W Macadamia Effect" );
  75. c++; item[c]=new Array("","","","full, LY5Z, E1","LY5Z/E1 Ocean Blue Metallic" );
  76. c++; item[c]=new Array("","","","full, ","" );
  77. c++; item[c]=new Array("","","","full, ","" );
  78. page="<html><head><title>Résultats de la recherche</title></head><body bgcolor='#EFEFEF'><center><table border=0 cellspacing=10 width=80%><b>Vos codes peinture!</b>";
  79. function search(frm) {
  80. win=window.open("","" );
  81. win.document.write(page);
  82. txt = frm.srchval.value.split(" " );
  83. fnd = new Array(); total=0;
  84. for (i = 0; i < item.length; i++) {
  85. fnd[i] = 0; order = new Array(0, 4, 2, 3);
  86. for (j = 0; j < order.length; j++)
  87. for (k = 0; k < txt.length; k++)
  88. if (item[i][order[j]].toLowerCase().toUpperCase().indexOf(txt[k]) > -1 && txt[k] != "" )
  89. fnd[i] += (j+1);
  90. }
  91. for (i = 0; i < fnd.length; i++) {
  92. n = 0; w = -1;
  93. for (j = 0;j < fnd.length; j++)
  94. if (fnd[j] > n) { n = fnd[j]; w = j; };
  95. if (w > -1) total += show(w, win, n);
  96. fnd[w] = 0;
  97. }
  98. win.document.write("</table><br>code décodé(s): "+total+"<br><p>Pix3L</p></body></html>" );
  99. win.document.close();
  100. }
  101. function show(which,wind,link) {
  102. link = item[which][1] + item[which][0];
  103. line = "<tr><td><a href='"+link+"'>"+item[which][2]+"</a>  "+link+"<br>";
  104. line += item[which][4] + "<br>"+link+"</td></tr>";
  105. wind.document.write(line);
  106. return 1;
  107. }
 

ou alors ouvrir le resultat dans une frame?


Message édité par pix3l13 le 24-06-2013 à 18:36:16
Reply

Marsh Posté le 24-06-2013 à 18:14:20   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed