View Full Version : Combine two OnClick Events? Google Analtyics + Print window command?
ArchangelX
01-27-2010, 09:27 PM
Hello,
I'm reall confused on how I would write this script. I need a Print Button to print as well as perform a tracking function with Google Analytics. How would I write this code?
Thanks for your help!
<script>
document.write("<input type='button' " +
"onClick='window.print()' " +
"onClick='javascript:pageTracker._trackPageview('/hicom/coupon');" +
"class='printbutton' " +
"value='Print This Page'/>");
</script>
I know this is wong, but how would I combine the two OnClick events?
<script>
document.write("<input type='button' " +
"onClick='window.print(); pageTracker._trackPageview('/hicom/coupon');' " +
"class='printbutton' " +
"value='Print This Page'/>");
</script>
ArchangelX
01-28-2010, 01:56 AM
Hmm...I tried that but I must have written it wrong because it wouldn't print. Thanks for the help!
<script>
document.write("<input type='button' " +
"onClick='window.print(); pageTracker._trackPageview(\'/hicom/coupon\');' " +
"class='printbutton' " +
"value='Print This Page'/>");
</script>
ArchangelX
01-28-2010, 02:00 AM
Hmm...I tried that exact code, and it breaks the Print function as I thought. Any suggestions?
Here's the page..
http://www.pacificaviationmuseum.org/flightcoupon.html
Sorry:
<script>
document.write("<input type='button' " +
"onClick='window.print(); pageTracker._trackPageview(\"/hicom/coupon\");' " +
"class='printbutton' " +
"value='Print This Page'/>");
</script>
ArchangelX
01-28-2010, 05:45 PM
Awesome, that worked great. Thanks for the help...I'll remember it for future encounters. Too many 's huh?
Yea, I don't know why you're using javascript though...Glad to help you! Your welcome!
It seems your topic is solved... Please set the status to resolved.. To do this:
Go to your first post ->
Edit your first post ->
Click "Go Advanced" ->
Then in the drop down next to the title, select "RESOLVED"
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.