c4n10 Posted February 26, 2013 Share Posted February 26, 2013 Hello everyone, I am having some trouble with some drop-down boxes, here is the code: <div class='content_box'> <h3>Currency converter</h3> <form id='buy_form' action='?page=place_order' method='post'> <table id='exchanger'> <tr><td> <p><b>Currency I have:</b></p> <div class='currbox_wrapper'> <div id='incurrency' class='currbox' onclick='javascript:rolldown_in();'> <div class='currbox_right'> <b class='currcode'>BBQ</b> <img src='images/arrow_down.png' /> </div> <img class='currflag' src='images/bbq_flag.png' /> <span class='currname'>BBQCoin</span> </div> <div id='currsel_in'> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>BBQ</b> </div> <img class='currflag' src='images/bbq_flag.png' /> <span class='currname'>BBQCoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>BTC</b> </div> <img class='currflag' src='images/btc_flag.png' /> <span class='currname'>Bitcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>CLC</b> </div> <img class='currflag' src='images/clc_flag.png' /> <span class='currname'>Coiledcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>DVC</b> </div> <img class='currflag' src='images/dvc_flag.png' /> <span class='currname'>Devcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>FBX</b> </div> <img class='currflag' src='images/fbx_flag.png' /> <span class='currname'>Fairbrix</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>GGD</b> </div> <img class='currflag' src='images/ggd_flag.png' /> <span class='currname'>GeistGeld</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>GPC</b> </div> <img class='currflag' src='images/gpc_flag.png' /> <span class='currname'>Groupcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>IXC</b> </div> <img class='currflag' src='images/ixc_flag.png' /> <span class='currname'>IXCoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>LQC</b> </div> <img class='currflag' src='images/lqc_flag.png' /> <span class='currname'>Liquidcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>LTC</b> </div> <img class='currflag' src='images/ltc_flag.png' /> <span class='currname'>Litecoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>NMC</b> </div> <img class='currflag' src='images/nmc_flag.png' /> <span class='currname'>Namecoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>PPC</b> </div> <img class='currflag' src='images/ppc_flag.png' /> <span class='currname'>PPCoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>RUC</b> </div> <img class='currflag' src='images/ruc_flag.png' /> <span class='currname'>RuCoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>SLC</b> </div> <img class='currflag' src='images/slc_flag.png' /> <span class='currname'>Solidcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_in(this, true);'> <div class='currbox_right'> <b class='currcode'>TRC</b> </div> <img class='currflag' src='images/trc_flag.png' /> <span class='currname'>Terracoin</span> </div> </div> </div> </td> <td> <p><b>Currency I want:</b></p> <div class='currbox_wrapper'> <div id='outcurrency' class='currbox' onclick='javascript:rolldown_out();'> <div class='currbox_right'> <b class='currcode'>BTC</b> <img src='images/arrow_down.png' /> </div> <img class='currflag' src='images/btc_flag.png' /> <span class='currname'>Bitcoin</span> </div> <div id='currsel_out'> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>BBQ</b> </div> <img class='currflag' src='images/bbq_flag.png' /> <span class='currname'>BBQCoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>BTC</b> </div> <img class='currflag' src='images/btc_flag.png' /> <span class='currname'>Bitcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>CLC</b> </div> <img class='currflag' src='images/clc_flag.png' /> <span class='currname'>Coiledcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>DVC</b> </div> <img class='currflag' src='images/dvc_flag.png' /> <span class='currname'>Devcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>FBX</b> </div> <img class='currflag' src='images/fbx_flag.png' /> <span class='currname'>Fairbrix</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>GGD</b> </div> <img class='currflag' src='images/ggd_flag.png' /> <span class='currname'>GeistGeld</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>GPC</b> </div> <img class='currflag' src='images/gpc_flag.png' /> <span class='currname'>Groupcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>IXC</b> </div> <img class='currflag' src='images/ixc_flag.png' /> <span class='currname'>IXCoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>LQC</b> </div> <img class='currflag' src='images/lqc_flag.png' /> <span class='currname'>Liquidcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>LTC</b> </div> <img class='currflag' src='images/ltc_flag.png' /> <span class='currname'>Litecoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>NMC</b> </div> <img class='currflag' src='images/nmc_flag.png' /> <span class='currname'>Namecoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>PPC</b> </div> <img class='currflag' src='images/ppc_flag.png' /> <span class='currname'>PPCoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>RUC</b> </div> <img class='currflag' src='images/ruc_flag.png' /> <span class='currname'>RuCoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>SLC</b> </div> <img class='currflag' src='images/slc_flag.png' /> <span class='currname'>Solidcoin</span> </div> <div class='currsel_entry' onclick='javascript:select_currency_out(this, true);'> <div class='currbox_right'> <b class='currcode'>TRC</b> </div> <img class='currflag' src='images/trc_flag.png' /> <span class='currname'>Terracoin</span> </div> </div> </div> </td> </tr> <tr> <td> <input id='inamount' name='amount' class='curramount' type="text" size="20" value="" onkeyup='typed_amount_in();'> </td> <td> <input id='outamount' name='want_amount' class='curramount' type="text" size="20" value="" onkeyup='typed_amount_out();'> </td> </tr> <?php if ($loggedin) { ?> <tr><td></td><td> <input type='hidden' name='csrf_token' value="<?php echo $_SESSION['csrf_token']; ?>" /> <input type='hidden' name='type' value='' /> <input type='hidden' name='want_type' value='' /> <input type='submit' onclick='return buy_clicked();' value='Buy' /> </td></tr> <?php } ?> </table> </form> <?php if ($loggedin) { ?> <center><p> Use the above to give you an indication of the current exchange rates. </p> <?php show_balances($indent=true); ?> <p> Select the currency you wish to buy on the right, then click Buy. </p> <p>There is a 0.1% trading fee.</p></center> <?php } else { ?> <p> To begin trading you will need an OpenID account. </p> <p>If you do not have an OpenID login then we recommend <a href="https://www.myopenid.com/">MyOpenID</a>. <?php } ?> </div> <div class='content_box'> <h3>Crypto-Currencies</h3> <p> Crypto-currencies are a new form of currency which varies from traditional currencies in the fact that they are decentralized, safer to use and transactions can be conducted anonymously.<br /><br />To learn more, visit some of our sister sites:</p> <a href="http://bitcointalk.org", target="blank">Bitcoin Talk</a><br /><a href="http://forum.rucoin.us" target="blank">RuCoin Forum</a><br /><a href="http://forum.litecoin.net" target="blank">Litecoin Forum</a><br /><a href="http://ppcointalk.org" target="blank">PPCoin Talk</a> </p> </div> <div class='content_box'> <h3>Contact info</h3> <p>support@crypto-exchange.us</p> </div> I am unable to actually select most of the elements in the boxes. The correct items show, but they will not select. The items that do work are the same for both sides. For both drop-down boxes I am able to select BTC, LTC, PPC and RUC, the rest show in the drop-down list but will not select... Here is the back-end supporting code for this page: function set_curr_block(elem, currency, textname) { elem.children('.currflag').attr('src', 'images/'.concat(currency).concat('_flag.png')); elem.children('.currname').text(textname); elem.children('.currbox_right').children('.currcode').text(currency); } function set_currency(elem, currency) { switch(currency) { case 'bbq': set_curr_block(elem, 'bbq', 'BBQCoin'); break; case 'btc': set_curr_block(elem, 'btc', 'Bitcoin'); break; case 'clc': set_curr_block(elem, 'clc', 'Coiledcoin'); break; case 'dvc': set_curr_block(elem, 'dvc', 'Devcoin'); break; case 'fbx': set_curr_block(elem, 'fbx', 'Fairbrix'); break; case 'ggd': set_curr_block(elem, 'ggd', 'GeistGeld'); break; case 'gpc': set_curr_block(elem, 'gpc', 'Groupcoin'); break; case 'ixc': set_curr_block(elem, 'ixc', 'IXCoin'); break; case 'lqc': set_curr_block(elem, 'lqc', 'Liquidcoin'); break; case 'ltc': set_curr_block(elem, 'ltc', 'Litecoin'); break; case 'nmc': set_curr_block(elem, 'nmc', 'Namecoin'); break; case 'ppc': set_curr_block(elem, 'ppc', 'PPCoin'); break; case 'ruc': set_curr_block(elem, 'ruc', 'RuCoin'); break; case 'slc': set_curr_block(elem, 'slc', 'Solidcoin'); break; case 'trc': set_curr_block(elem, 'trc', 'Terracoin'); break; } } function set_currency_in(currency) { ic = $('#incurrency'); set_currency(ic, currency); } function set_currency_out(currency) { ic = $('#outcurrency'); set_currency(ic, currency); } function rolldown(cs, ic) { if (cs.css('visibility') == 'hidden') { cs.position({ my: "left top", at: "left bottom", of: ic }); cs.css('visibility', 'visible'); } else cs.css('visibility', 'hidden'); } function hide_rolldown(cs) { cs.css('visibility', 'hidden'); } function rolldown_in() { rolldown($('#currsel_in'), '#incurrency'); hide_rolldown($('#currsel_out')); } function rolldown_out() { rolldown($('#currsel_out'), '#outcurrency'); hide_rolldown($('#currsel_in')); } function select_currency_in(caller) { $('#currsel_in').css('visibility', 'hidden'); curr = jQuery('.currcode', caller).text(); curr = curr.toLowerCase(); set_currency_in(curr); set_currency_out(twin_currency(curr), false); $('#inamount').attr('value', ''); typed_amount_in(); } function select_currency_out(caller) { $('#currsel_out').css('visibility', 'hidden'); curr = jQuery('.currcode', caller).text(); curr = curr.toLowerCase(); set_currency_out(curr); set_currency_in(twin_currency(curr)); $('#outamount').attr('value', ''); typed_amount_out(); } function typed_amount(this_name, change_name) { this_obj = $('#' + this_name + 'amount'); change_obj = $('#' + change_name + 'amount'); a_obj = $('#inamount'); b_obj = $('#outamount'); a_curr = jQuery('.currcode', '#incurrency').text(); b_curr = jQuery('.currcode', '#outcurrency').text(); if (a_curr in exchange_rates) { a_curr_rates = exchange_rates[a_curr]; if (b_curr in a_curr_rates) { text_field = this_obj.attr('value'); if (text_field == '') { change_obj.attr('value', 0); return; } else if (isNaN(text_field)) { change_obj.attr('value', '-'); return; } rate = a_curr_rates[b_curr]; val = parseFloat(text_field); val *= rate; change_obj.attr('value', val.toFixed(2)); } else { b_obj.attr('value', 'N/A'); } } else { b_obj.attr('value', 'N/A'); } } function typed_amount_in() { typed_amount('in', 'out'); } function typed_amount_out() { //typed_amount('out', 'in'); } function buy_clicked() { curr_type = jQuery('.currcode', '#incurrency').text(); want_curr_type = jQuery('.currcode', '#outcurrency').text(); amount = $('#inamount').attr('value'); want_amount = $('#outamount').attr('value'); $("input[name='type']").val(curr_type); $("input[name='amount']").val(amount); if (amount == '' || want_amount == '' || isNaN(amount) || isNaN(want_amount)) { alert("Invalid amount specified."); return false; } $("input[name='want_type']").val(want_curr_type); $("input[name='want_amount']").val(want_amount); return true; } If you need any more information, please feel free to ask, any help is greatly appreciated, thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/ Share on other sites More sharing options...
Jessica Posted February 26, 2013 Share Posted February 26, 2013 What does it have to do with PHP? I'm moving this to the javascript section. You don't actually have any HTML for a dropdown (select). So you must be doing everything js. Which is probably not the best idea. Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1414997 Share on other sites More sharing options...
c4n10 Posted February 26, 2013 Author Share Posted February 26, 2013 (edited) What does it have to do with PHP? I'm moving this to the javascript section. You don't actually have any HTML for a dropdown (select). So you must be doing everything js. Which is probably not the best idea. The entire backend code that makes the page work is php...? EDIT: Ah, I see I am mistaken, the page has a php extension but is written in html and java, my mistake... Why is java not a good choice for simple drop-down boxes...? I will be filtering the input fields on this page, just want working code first... Edited February 26, 2013 by c4n10 Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415000 Share on other sites More sharing options...
Jessica Posted February 26, 2013 Share Posted February 26, 2013 Java != Javascript. Javascript can be easily turned off. There's also no reason to use it for something that HTML does natively. Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415001 Share on other sites More sharing options...
c4n10 Posted February 26, 2013 Author Share Posted February 26, 2013 Java != Javascript. Javascript can be easily turned off. There's also no reason to use it for something that HTML does natively. So I can just comment out or remove the java and it should still work as html...? Sorry, I didn't write this code, lol.... I've been digging through it trying to put together a site modifying someone else's open source code (intersango) and have most of it working, but for some reason just can not get these drop-down boxes to work... Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415005 Share on other sites More sharing options...
Jessica Posted February 26, 2013 Share Posted February 26, 2013 There is no Java code in your posts. Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415006 Share on other sites More sharing options...
c4n10 Posted February 26, 2013 Author Share Posted February 26, 2013 There is no Java code in your posts. So strange because the first code came from "index.php" and the second code came from "exchanger.js" I can still call those functions in the second code without the need for the onclick='javascript:rolldown' and other onclick='javascript:*' functions...? How would I go about editing out the java calls while still maintaining operability of the functions being called...? Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415008 Share on other sites More sharing options...
Jessica Posted February 26, 2013 Share Posted February 26, 2013 You could try using P or HT, if you insist on using Java. Don't forget to use some MyS as well. I personally like jQue and Smar a lot, but it looks like you've got it covered with your Java. Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415010 Share on other sites More sharing options...
c4n10 Posted February 26, 2013 Author Share Posted February 26, 2013 You could try using P or HT, if you insist on using Java. Don't forget to use some MyS as well. I personally like jQue and Smar a lot, but it looks like you've got it covered with your Java. Well, I don't insist on using java, I just don't know how I would change it, as I said I didn't write the code myself, I'm not the world's greatest web developer, especially when modifying someone else's half-rate code, lol... If you can suggest how I can modify the code so I can completely disable java and maintain operability of the functions being called from the second page of code I would be more than happy to change it =) Also, if you can point out why the drop-down boxes allow me to select Bitcoin, Litecoin, PPCoin and RuCoin but won't allow me to select any of the others that would be awesome too as I can't find any difference between the ones that ARE working and the ones that AREN'T and it's driving me crazy, lol... Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415015 Share on other sites More sharing options...
Jessica Posted February 26, 2013 Share Posted February 26, 2013 Look this will be my last post, I was making a point to you. http://en.wikipedia.org/wiki/Java_(programming_language) http://en.wikipedia.org/wiki/Javascript If you didn't write the code and don't even know what the language is, you won't be able to change it. You should probably hire someone to fix it, or learn HTML and JS. Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415017 Share on other sites More sharing options...
c4n10 Posted February 26, 2013 Author Share Posted February 26, 2013 Look this will be my last post, I was making a point to you. http://en.wikipedia....amming_language) http://en.wikipedia....wiki/Javascript If you didn't write the code and don't even know what the language is, you won't be able to change it. You should probably hire someone to fix it, or learn HTML and JS. Wow... Come to a php help forum to ask for help with a page called "index.php" and catch attitude, disrespect and hostility from an apparent moderator... WTF just happened...? Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415018 Share on other sites More sharing options...
DavidAM Posted February 26, 2013 Share Posted February 26, 2013 @c4n10 Read very carefully the responses Jessica provided. She was gently trying to tell you that you were calling the code something it is not. But you continually ignored her gentle prodding, so she became less and less subtle. At this point, it is clear that you don't know what you are talking about and (the bigger problem) you are not listening to people who are trying to help. What does it have to do with PHP? I'm moving this to the javascript section. Java != Javascript. There is no Java code in your posts. Look this will be my last post, I was making a point to you. http: //en.wikipedia.org/wiki/Java_(programming_language) http: //en.wikipedia.org/wiki/Javascript And just in case you still don't get it: THERE IS A MAJOR DIFFERENCE BETWEEN JAVA AND Javascript. THE CODE YOU SHOWED IS Javascript, NOT JAVA I think her final assessment is on the money: If you didn't write the code and don't even know what the language is, you won't be able to change it. You should probably hire someone to fix it,I don't know enough JS to provide any insight. Although all of your onclick calls are passing two parameters to functions that only accept one parameter -- maybe that's some special JS thing, I don't know. The issue may also be with the CSS changes being made by some of those functions. Hopefully, someone with more JS knowledge than me might come along and help. But if you don't start listening to people who are trying to help, I doubt anyone will spend any significant time on it. Quote Link to comment https://forums.phpfreaks.com/topic/274947-partially-working-drop-down-boxes/#findComment-1415055 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.