DaeBo Posted June 15, 2017 Report Share Posted June 15, 2017 I am using the JavaScript from this "Limit the Number of Submissions" article to display one hyperlinked image or another hyperlinked image based on meeting a condition. This is the original JavaScript from the article: <script> if([@field:Attendees] <[@field:Maximum_Attendees]) { document.write("<a href='SubmissionURL&Course_ID=[@field:Course_ID]'> Signup </a>"); } else { document.write("<p>Signup Closed</p>") } </script> This is my modified version with image links instead of text links: <script> if([@field:Keyword_Count#] <[@field:Max_Keywords#]) { document.write("<a href='URLwithPARAMETERS'><img src='IMAGEURL'></a>"); } else { document.write("<a href='URLwithPARAMETERS'><img src='IMAGEURL'></a>") } </script> Currently, when a visitor clicks on the image, the destination of the hyperlink is the same window. I would like the destination to be a popup window with resized window. I already use JavaScript popup code in another DataPage, so I figured I would paste and modify as so document.write("<a onclick="window.open(...); return false"><img></a>"), but this does not work. JavaScript popup code that works on another app, outside of the document.write("..."). <a onclick="window.open('URLwithPARAMETERS','popup','width=550,height=200, scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=50,top=50'); return false"><img alt="Delete" src="IMAGEURL" style="width: 20px; height: 20px; margin: 1px;" /></a> Any recommendations? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted July 3, 2017 Report Share Posted July 3, 2017 Try this one then: <div id="MyLink[@field:UniqueID]"></div> <script> if([@field:Keyword_Count#] <[@field:Max_Keywords#]) { document.getElementById("MyLink[@field:UniqueID]").innerHTML = '<a onclick="window.open(\'URLwithPARAMETERS\',\'popup\',\'width=550,height=200, scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=50,top=50\'); return false"><img alt="Delete" src="IMAGEURL" style="width: 20px; height: 20px; margin: 1px;" /></a>' } else { .... } </script> <div id="MyLink[@field:UniqueID]"></div> <script> if([@field:Keyword_Count#] <[@field:Max_Keywords#]) { document.getElementById("MyLink[@field:UniqueID]").innerHTML = '<a onclick="window.open(\'URLwithPARAMETERS\',\'popup\',\'width=550,height=200, scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=50,top=50\'); return false"><img alt="Delete" src="IMAGEURL" style="width: 20px; height: 20px; margin: 1px;" /></a>' } else { .... } </script> Select [@field:UniqueID] from picker and it should be a unique field in your table 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.