Quick Javascript question

ImagesAndWords

StayblCam.com
Nov 7, 2006
2,324
90
0
Scottsdale, Arizona
www.stayblcam.com
Ok, so I'm trying to do something basic (I thought) with Javascript for a LP I made.

I'm trying to add an Aweber lightbox popover to the page, but instead of it popping up automatically - I want the form to only pop over when the user clicks a button (and not one of those generic "input" type buttons, I mean a graphic JPG button). I have my own graphic button that when clicked, is supposed to load the .js popover code that looks like this:
Code:
http://forms.aweber.com/form/69/343629929.js
(not my .js btw)

I'm not a coder but I tried to learn this myself using onClick and loadFile.. but now I'm just getting annoyed with it, lol.
Any coders care to tell me how it's done? :)

Thanks!!
 


Post the code you've got and I'll edit it for you.
Swap out your id's first of course.
 
Post the code you've got and I'll edit it for you.
Swap out your id's first of course.

I appreciate it dude :)

Alright, so on my PHP lander I have a button like this:
Code:
<img src="/images/signup.png"/>
And then I have the code given to me by Aweber, which is this:
Code:
<script type="text/javascript" src="http://forms.aweber.com/form/69/340189267.js"></script>
From what I gather, I'll need an <a> anchor wrapped around the img code in order to "link" the button to load the external .js file on demand so to speak.

I know I can call a function using onClick, but in this case I need to call the entire .js (or somehow have it pre-loaded and then ran when the button is clicked). Am I onto something? :confused:

The Aweber code by itself simply loads the popover as soon as the page loads.
 
I use a custom lightbox and JS for these type of things...

Bottom line is you can't do it without hosting the JS yourself and editing to your needs. The file Aweber gives you will spitout the form with no control over it.

Here's what I'd do:


  • Don't hotlink their JS file.
  • Choose the "Raw HTML Version" option instead and save it all into a new file called something like "pop.html".
  • Upload this to your blog via FTP.
  • Use one of the many lightbox packages on the web that allows iframe popups.
  • Upload the files and add the JS call to your blogs header.
  • Just add something like 'rel="pop[iframe|300x500]"' or whatever the packages needs to the link with the target being pop.html.

Gives you way more control over how it works, what it looks like and when it fires.
 
I use a custom lightbox and JS for these type of things...

Bottom line is you can't do it without hosting the JS yourself and editing to your needs. The file Aweber gives you will spitout the form with no control over it.

Here's what I'd do:


  • Don't hotlink their JS file.
  • Choose the "Raw HTML Version" option instead and save it all into a new file called something like "pop.html".
  • Upload this to your blog via FTP.
  • Use one of the many lightbox packages on the web that allows iframe popups.
  • Upload the files and add the JS call to your blogs header.
  • Just add something like 'rel="pop[iframe|300x500]"' or whatever the packages needs to the link with the target being pop.html.

Gives you way more control over how it works, what it looks like and when it fires.

Interesting approach. Yeah I don't mind hosting it myself but for the lightbox, they don't provide html - only that JS snippet.
 
What he's saying though is you don't need their JS snippet if you get your own lightbox script that you load on your LP.

You just need to find the URL that their JS is opening in their lightbox. Once you have that you can open it anyway you like using a lightbox script. There are a lot out there like suggested. Although it's $40 Lightview is one of the better ones out there (hence the cost) but there are quite a few that will do what you want for free.