Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Before AJAX was coined and a billion libraries were created, this script was created to be a solution to a problem
- # where we wanted page to update images without reloading the page.
- <script type='text/javascript' language="javascript">
- <!--
- var IFrameObj; // IFrame object
- function callToServer(condition) {
- if (!document.createElement) {return true};
- var IFrameDoc;
- var URL = './secured/server.php?'+condition+'&thePic='+document.images['forSale'].src;
- if (!IFrameObj && document.createElement) {
- // create the IFrame and assign a reference to the
- // object to our global variable IFrameObj.
- // this will only happen the first time
- // callToServer() is called
- var tempIFrame=document.createElement('iframe');
- tempIFrame.setAttribute('id','RSIFrame');
- tempIFrame.style.border='0px';
- tempIFrame.style.width='0px';
- tempIFrame.style.height='0px';
- IFrameObj = document.body.appendChild(tempIFrame);
- if (document.frames) {
- // this is for IE5 Mac, because it will only
- // allow access to the document object
- // of the IFrame if we access it through
- // the document.frames array
- IFrameObj = document.frames['RSIFrame'];
- }
- }
- if (navigator.userAgent.indexOf('Gecko') !=-1
- && !IFrameObj.contentDocument) {
- // we have to give NS6 a fraction of a second
- // to recognize the new IFrame
- setTimeout('callToServer()',10);
- return false;
- }
- if (IFrameObj.contentDocument) {
- // For NS6
- IFrameDoc = IFrameObj.contentDocument;
- } else if (IFrameObj.contentWindow) {
- // For IE5.5 and IE6
- IFrameDoc = IFrameObj.contentWindow.document;
- } else if (IFrameObj.document) {
- // For IE5
- IFrameDoc = IFrameObj.document;
- } else {
- return true;
- }
- IFrameDoc.location.replace(URL);
- return false;
- }
- function replacePara(newBioText){
- var newPara = document.createElement("p");
- var newText = document.createTextNode(newBioText);
- newPara.appendChild(newText);
- var bodyRef = document.getElementById("artistBio");
- var para = document.getElementById("oldText");
- newPara.id = para.id;
- var replaced = bodyRef.replaceChild(newPara,para);
- }
- function handleArtistResponse(pic1,pic2,bioText,thumb1,thumb2,thumb3,thumb4,thumb5,thumb6) {
- document.images['artistBioImage'].src=pic1;
- document.images['forSale'].src=pic2;
- replacePara(bioText);
- document.images['thumbnail1'].src=thumb1;
- document.images['thumbnail2'].src=thumb2;
- document.images['thumbnail3'].src=thumb3;
- document.images['thumbnail4'].src=thumb4;
- document.images['thumbnail5'].src=thumb5;
- document.images['thumbnail6'].src=thumb6;
- }
- function handleThumbnailResponse(thumb,width,height){
- document.images['forSale'].src=thumb;
- document.anchors['theAnchor'].href=thumb;
- }
- function handleThumbnailScroll(thumb1,thumb2,thumb3,thumb4,thumb5,thumb6)
- {
- document.images['thumbnail1'].src=thumb1;
- document.images['thumbnail2'].src=thumb2;
- document.images['thumbnail3'].src=thumb3;
- document.images['thumbnail4'].src=thumb4;
- document.images['thumbnail5'].src=thumb5;
- document.images['thumbnail6'].src=thumb6;
- }
- function Redirect()
- {
- window.location="viewcart.php?thePic="+document.images['forSale'].src;
- }
- //-->
- </script>
Add Comment
Please, Sign In to add comment