Calling JavaScript in text link

I am trying to utilize the JavaScript located here: https://magic.wizards.com/en/articles/archive/arcana/autocard-windows-2002-08-29. Essentially, the JavaScript loads a pop-up of the card’s image when you mouse-over the text card name on the web-page.

Is it possible to get this to function on the Wix platform? If so, could someone kindly explain how to get it to work?

Thank you.

WixCode understands all of Javascript, except for anything that accesses the DOM. This keeps the user from inadvertently “breaking” something. Accessing document elements such as div, span, button, etc is off-limits. The way to access elements on the page is only through $w.

One small exception is the $w.HtmlComponent (which is based on an iFrame). This element was designed to contain vanilla HTML and it works just fine. You just can’t try to trick it by using parent, window, top, etc. Same goes with the Javascript evaluate() function. It is sandboxed and does not allow access to the DOM.

Yisrael, thank you for your reply. Unfortunately, since I’m not a programmer, I don’t really understand your comment. Is using this JavaScript possible on the Wix platform? If so, how would it be implemented?

script language="Javascript"
 function WizardsAutoCard (cardname) { 

				  windowName = "WotCWindow";

				  params = "toolbar=0, location=0, directories=0, status=0,

				 
				  menubar=0, scrollbars=0, resizable=0, width=450, height=400";

				  win = window.open
("http://www.wizards.com/magic/autocard.asp?name="+cardname, 

				 
				  windowName, params);
 }
/script

And then you can make a card link like this:

				a href="javascript:WizardsAutoCard('Call of the Herd');"
Call of the Herd
/a

I’m guessing that since I cannot edit the link code for text, it cannot work.

Thank you.

The script you posted is from 2002. It will not work.

Edit: specifically the opening/closing tags are not properly formatted. If the script hasn’t been updated in 16 years I’m gonna guess the service is depreciated.

Do you know of a way to accomplish this?

@koert You may want to check out the WixArena - it’s a hub where you can look for Wix Code (and other) experts for hire.

It doesn’t exist anymore, and it is not from 2002 but from 2019.