pgjacob Posted February 22, 2018 Report Share Posted February 22, 2018 Hi I am re-using a javascript code I have used many times successfully in the past, but I can't seem to get it to work now. It DOES work when I preview the datapage, but on the live website it does not. I am using a conditional display that I have confirmed still works on other live websites, it was copied directly from a datapage that is currently working but I switched out the field using field picker and the image link... <script> var link_text="[@field:Make]"; var src_address="https://banjimmie.weebly.com/uploads/2/8/3/6/28360873/chevy_orig.png"; var image_to_display='<a href="' + link_text + '"><img src="' + src_address + '"></a>'; if (link_text=='Chevrolet') { document.write(image_to_display); } </script> Previewing this directly from the datapage WORKS. Viewing on my live website DOES NOT. I use Weebly, and this code still works on all my other weebly sites for other pages. I am very confused. I use a hidden page on weebly to view the image rather than uploading to Caspio. This works on my other sites. thanks melissa Quote Link to comment Share on other sites More sharing options...
MayMusic Posted February 27, 2018 Report Share Posted February 27, 2018 document.write is not supported anymore this might be the issue. Try the code below and select the unique field instead of [@field:Id] from picker <div id="link[@field:Id]"></div> <script> var isi = document.getElementById("link[@field:Id]"); var link_text="[@field:Make]"; var src_address="https://banjimmie.weebly.com/uploads/2/8/3/6/28360873/chevy_orig.png"; var image_to_display='<a href="' + link_text + '"><img src="' + src_address + '"></a>'; if (link_text=='Chevrolet') { isi.innerHTML = image_to_display; } </script> Is this is not helping either provide the URL to the page here Quote Link to comment Share on other sites More sharing options...
pgjacob Posted March 3, 2018 Author Report Share Posted March 3, 2018 Yippee! It works! Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.