Guest User

Untitled

a guest
Feb 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. # Before AJAX was coined and a billion libraries were created, this script was created to be a solution to a problem
  2. # where we wanted page to update images without reloading the page.
  3.  
  4. <script type='text/javascript' language="javascript">
  5. <!--
  6. var IFrameObj; // IFrame object
  7. function callToServer(condition) {
  8. if (!document.createElement) {return true};
  9. var IFrameDoc;
  10. var URL = './secured/server.php?'+condition+'&thePic='+document.images['forSale'].src;
  11. if (!IFrameObj && document.createElement) {
  12. // create the IFrame and assign a reference to the
  13. // object to our global variable IFrameObj.
  14. // this will only happen the first time
  15. // callToServer() is called
  16. var tempIFrame=document.createElement('iframe');
  17. tempIFrame.setAttribute('id','RSIFrame');
  18. tempIFrame.style.border='0px';
  19. tempIFrame.style.width='0px';
  20. tempIFrame.style.height='0px';
  21. IFrameObj = document.body.appendChild(tempIFrame);
  22.  
  23. if (document.frames) {
  24. // this is for IE5 Mac, because it will only
  25. // allow access to the document object
  26. // of the IFrame if we access it through
  27. // the document.frames array
  28. IFrameObj = document.frames['RSIFrame'];
  29. }
  30. }
  31.  
  32. if (navigator.userAgent.indexOf('Gecko') !=-1
  33. && !IFrameObj.contentDocument) {
  34. // we have to give NS6 a fraction of a second
  35. // to recognize the new IFrame
  36. setTimeout('callToServer()',10);
  37. return false;
  38. }
  39.  
  40. if (IFrameObj.contentDocument) {
  41. // For NS6
  42. IFrameDoc = IFrameObj.contentDocument;
  43. } else if (IFrameObj.contentWindow) {
  44. // For IE5.5 and IE6
  45. IFrameDoc = IFrameObj.contentWindow.document;
  46. } else if (IFrameObj.document) {
  47. // For IE5
  48. IFrameDoc = IFrameObj.document;
  49. } else {
  50. return true;
  51. }
  52.  
  53. IFrameDoc.location.replace(URL);
  54. return false;
  55. }
  56. function replacePara(newBioText){
  57.  
  58. var newPara = document.createElement("p");
  59. var newText = document.createTextNode(newBioText);
  60. newPara.appendChild(newText);
  61.  
  62. var bodyRef = document.getElementById("artistBio");
  63. var para = document.getElementById("oldText");
  64. newPara.id = para.id;
  65. var replaced = bodyRef.replaceChild(newPara,para);
  66. }
  67. function handleArtistResponse(pic1,pic2,bioText,thumb1,thumb2,thumb3,thumb4,thumb5,thumb6) {
  68. document.images['artistBioImage'].src=pic1;
  69. document.images['forSale'].src=pic2;
  70. replacePara(bioText);
  71. document.images['thumbnail1'].src=thumb1;
  72. document.images['thumbnail2'].src=thumb2;
  73. document.images['thumbnail3'].src=thumb3;
  74. document.images['thumbnail4'].src=thumb4;
  75. document.images['thumbnail5'].src=thumb5;
  76. document.images['thumbnail6'].src=thumb6;
  77. }
  78. function handleThumbnailResponse(thumb,width,height){
  79. document.images['forSale'].src=thumb;
  80. document.anchors['theAnchor'].href=thumb;
  81. }
  82. function handleThumbnailScroll(thumb1,thumb2,thumb3,thumb4,thumb5,thumb6)
  83. {
  84. document.images['thumbnail1'].src=thumb1;
  85. document.images['thumbnail2'].src=thumb2;
  86. document.images['thumbnail3'].src=thumb3;
  87. document.images['thumbnail4'].src=thumb4;
  88. document.images['thumbnail5'].src=thumb5;
  89. document.images['thumbnail6'].src=thumb6;
  90. }
  91. function Redirect()
  92. {
  93. window.location="viewcart.php?thePic="+document.images['forSale'].src;
  94. }
  95. //-->
  96. </script>
Add Comment
Please, Sign In to add comment