• 0

How do I Direct Link to a Javascript Component?


Question

I run a photography / writing website called http://www.shutterscript.com. My photos are hosted off-site at smugmug (http://gallery.shutterscript.com). I have been working over the past few days to make my smugmug gallery and my main site look the same. In the process of discovering CSS (and its steep learning curve) I have run into a problem linking to certain components on my gallery page. The gallery uses javascript heavily and after considerable searching I have been unable to figure out how to link to one of their javascript components. All my search results turn up how to open one of my own links in a javascript window which is not what I am trying to do.

Here is what I want to do exactly:

The following link will take you to one of my photos:

http://gallery.shutterscript.com/gallery/3782986#218041532

If you click the "buy this photo" button directly above the photo it launches this cool javascript window by calling the following command:

java script:addCartSingle(ImageID);

Is there a way I can link directly to this javascript window with an href link?

Thanks in advance.

5 answers to this question

Recommended Posts

  • 0

IT's one sexy front-end when you click on the Buy link, isn't it! Beautiful.

Unfortunately though that window is entirely created using Javascript etc. on the page so it's by no means a trivial task to somehow navigate to a page and make it there. However it depends on exactly what you'll be using this for. If, for example, you just want to link to this Buy screen from another thumbnail on your site (outside the Gallery), and then have that load this page and automatically pop open the Buy window, that is something that IS possible.

Bit of clarification of why you want to do this, and I'm sure we can come up with a solution :)

  • 0

Rob, thanks for your reply. It definitely is a sexy front end.

Let me explain a bit further what I'm trying to do. On my main website, www.shutterscript.com I want to link to photos that are hosted on my gallery page (i.e. smugmug). Right now I do the following:

<a href="http://gallery.shutterscript.com/gallery/3781394#219133211-A-LB" title="Buy"><img src="http://gallery.shutterscript.com/photos/219133211-M.jpg" alt="Rights of Passage" ></a>

However, that only takes me to the photo page and not the shopping cart. I somehow want a user to be able to click on a thumbnail on my main site and then get redirected to the smugmug shopping cart for that photo. That would involve going to the link I noted above, then invoking this javascript function "java script:addCartSingle(ImageID);" with the appropriate image ID. I want to bypass the photo page and go directly to the shopping cart in order to reduce the number of steps users need to take in order to purchase a photo.

  • 0

Here's the source html from the photo page that calls the shopping cart:

<span class="title">buy:</span>

<div class="singleImageBuyLinks" style="display: inline">

<a href="java script:addCartSingle(ImageID);" class="nav"><span class="extraNav">this </span>photo</a>

<a href="java script:addCartSingle(ImageID);"><img src="/img/spacer.gif" alt="buy this photo" title="buy this photo" width="21" height="18" hspace="0" vspace="0" border="0" class="cart_add" /></a>

I somehow need to add a link that takes me to the hyperlink (http://gallery.shutterscript.com/gallery/3781394#219133211-A-LB) first, then does the above:

  • 0

I'm assuming this isn't possible, would violate cross site scripting stuff.

What i'm assuming is you want to be able to link to a page, then run commands on that page, if so that isn't possible (uless the page you're linking to is on your site, same domain)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.