Ultrashock Forums > Development > Client Side
PayPal Buy Now button rollovers with CSS?

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
PayPal Buy Now button rollovers with CSS?
Old 2009-04-18

hey guys, is it possible to use paypal's buy now button generator code and give it a css valid rollover? normally i do rollovers like this:
Code:
#navButton {
     position: absolute;
     width: 200px;
     height: 80px;
     margin-top: 0px;
     margin-left: 0px;
     z-index: 2;
}

a.navButton {
     display: block;
     width: 200px;
     height: 80px;
     outline: none;
     background-image: url(../images/navWeek.jpg);
     background-repeat: no-repeat;
     background-position: 0px 0px;
     z-index: 2;
}
	 
a.navButton:hover {
     background-position: 0px -80px;
     z-index: 2;
}
the paypal generator gives you this code:

Code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
     <input type="hidden" name="cmd" value="_s-xclick">
     <input type="hidden" name="hosted_button_id" value="blah blah blah">
     <input type="image" src="http://www.yoursite.com/navButton.jpg" name="submit" alt="">
     <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif">
</form>
i tried a bunch of different ways and couldn't figure out how to make that button hover! any help would be greatly greatly appreciated. thanks!
i'm not crazy. i'm just sane in a crazy world!
postbit arrow 4 comments | 1180 views postbit arrow Reply: with Quote   
Registered User
midnite is offline
seperator
Posts: 986
2003-01-27
midnite lives in United States
midnite's Avatar
seperator

Ultrashock Member Comments:
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator Nutrox lives in United Kingdom 17 Creative Assets 2009-04-18 #2 Old  
You could take the button input element out of the form and create a standard link to submit the form.

Code:
<a id="ppbutton" href="#" onclick="document.getElementById('ppform').submit();return false"></a>
Just give the form a ppform ID. Normally I wouldn't have the JS on the link like that but hey-ho.

Reply With Quote  
midnite's Avatar midnite midnite is offline midnite lives in United States 2009-04-18 #3 Old  
sweet! thanks dude, worked like a charm. i was trying to put a hover class on the image with no luck.

this worked:

Code:
<div id="navButton">
    <form id="ppform" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="blah blah blah">
    <a class="navButton" href="#" onclick="document.getElementById('ppform').submit();return false"></a>
    </form>
</div>
thanks again
Reply With Quote  
midnite's Avatar midnite midnite is offline midnite lives in United States 2009-04-18 #4 Old  
by the way, any idea what this does?

Code:
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
the paypal generator adds that in, but i can't see what it's purpose would be other then as a tracker of sorts to see how many times that gif has been downloaded? just want to make sure it's safe to remove that.
Reply With Quote  
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator Nutrox lives in United Kingdom 17 Creative Assets 2009-04-18 #5 Old  
I have no idea what that does to be honest but I imagine it is some kind of tracker as you mentioned. The only thing I can suggest is commenting it out and testing the form through PayPal's sandbox if you are using one, if everything works properly then I guess there is no harm removing that image (it doesn't get sent with the form anyway).
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: