stickypod Posted August 11, 2010 Posted August 11, 2010 The premise: How do I get javascript buttons to work in a PHP line of code? My goal: I want to display buttons that will function just like a person pushing a button. Example: Here's my account page (/osc/account.php) coding at line 115: <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td> Obviously, this displays the "view" button for order history on the account page. Now I want to add the functions you can see on this page: http://www.heibel.us/script/imageswap.html As you will see on the above page, it preloads the images and when you push a button, it looks and feels as though you're actually pushing a button (feel free to copy the coding, no charge :thumbsup: ) , so how do I incorporate this into my store? This is purely a vanity trick and I'm in no hurry for a reply. I have been playing with this for a few days, but no luck. It's just a little over my head. Any takers? Anyone can buy a camera... it's what you do with it that counts! Sticky Pod www.stickypod.com
♥FWR Media Posted August 11, 2010 Posted August 11, 2010 The premise: How do I get javascript buttons to work in a PHP line of code? My goal: I want to display buttons that will function just like a person pushing a button. Example: Here's my account page (/osc/account.php) coding at line 115: <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td> Obviously, this displays the "view" button for order history on the account page. Now I want to add the functions you can see on this page: http://www.heibel.us/script/imageswap.html As you will see on the above page, it preloads the images and when you push a button, it looks and feels as though you're actually pushing a button (feel free to copy the coding, no charge :thumbsup: ) , so how do I incorporate this into my store? This is purely a vanity trick and I'm in no hurry for a reply. I have been playing with this for a few days, but no luck. It's just a little over my head. Any takers? I think the thing to remember here is that there is no "PHP code" as far as the browser is concerned all PHP does ( in a template/display/layout ) scenario is return HTML. ( and javascript which can interact with HTML source code ) Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
♥zelf Posted August 12, 2010 Posted August 12, 2010 tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) Obviously, this displays the "view" button for order history on the account page. Now I want to add the functions you can see on this page: http://www.heibel.us/script/imageswap.html function tep_image_button($image, $alt = '', $parameters = '') takes a third parameter. For example: tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW, 'myJavaCode("param"); return false;') Virtual Merchant a.k.a. Elavon, ViaKlix, Nova Payment Module Contribution
stickypod Posted August 12, 2010 Author Posted August 12, 2010 function tep_image_button($image, $alt = '', $parameters = '') takes a third parameter. For example: tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW, 'myJavaCode("param"); return false;') Thank you zelf. I tried several configs of your suggestion, but I'm just not getting the syntax down. I think you're on the right track, but I'm still missing something. Here's the javascript coding I need to incorporate into that line: <a href="http://www.myaccounthistorypage.com" onmousedown="document.View.src='stickypod_view_down.gif'" onmouseup="document.View.src='stickypod_view_up.gif'"> <img src="stickypod_view_up.gif" height="60" border="0" name="View" id="View" /> All I can manage to get is: Parse error: syntax error, unexpected T_STRING in /xxxx/yyyyyyy/public_html/osc/account.php on line 115 Anyone can buy a camera... it's what you do with it that counts! Sticky Pod www.stickypod.com
♥FWR Media Posted August 12, 2010 Posted August 12, 2010 Thank you zelf. I tried several configs of your suggestion, but I'm just not getting the syntax down. I think you're on the right track, but I'm still missing something. Here's the javascript coding I need to incorporate into that line: <a href="http://www.myaccounthistorypage.com" onmousedown="document.View.src='stickypod_view_down.gif'" onmouseup="document.View.src='stickypod_view_up.gif'"> <img src="stickypod_view_up.gif" height="60" border="0" name="View" id="View" /> All I can manage to get is: Parse error: syntax error, unexpected T_STRING in /xxxx/yyyyyyy/public_html/osc/account.php on line 115 Something like the below I'd imagine: - <td class="main" align="right"> <?php echo '<a href="' . tep_href_link( FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . (int)$orders['orders_id'], 'SSL' ) . ' " onmousedown="document.View.src=\'stickypod_view_down.gif\'" onmouseup="document.View.src=\'stickypod_view_up.gif\'"> ' . tep_image_button( 'stickypod_view_up.gif', SMALL_IMAGE_BUTTON_VIEW, 'height="60" id="view"' ) . ' </a>'; ?> </td> Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
stickypod Posted August 13, 2010 Author Posted August 13, 2010 So far, no joy. The problem seems to be with the java mouse actions. The "action" line and the image attributes, seemingly are ignored. While the syntax can be right and the page is drawn, unfortunately there's no function. So it appears that this line: onmousedown="document.View.src='stickypod_view_down.gif'" onmouseup="document.View.src='stickypod_view_up.gif'" Is being ignored, and these attributes (height="60" border="0" name="View" id="View") are being ignored. All I get is the "stickypod_view_up.gif" to show, but no action in the button. I was wondering if there might be a solution in the functions folder and/or html_output.php file? I'm going to play with it and see what I come up with. If anyone has any ideas or a contrib that has some similar functions, please let me know. Of course, I will share the entire solution for everyone to use. Anyone can buy a camera... it's what you do with it that counts! Sticky Pod www.stickypod.com
Recommended Posts
Archived
This topic is now archived and is closed to further replies.