Jump to content

sloth456

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Everything posted by sloth456

  1. Hi, I've already had help creating my own spinbox wich looks like this - 0 + When you click the plus button the number increments by 1 and decrements by 1 if you click the minus button. The code for this is below <html> <body> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('.minus').click(function() { var curr = parseInt($(this).parent().find('.cdisp').html()); if (curr > 0) { $(this).parent().find('.cdisp').html(curr-1); $('#spare').html(parseInt($('#spare').html())+1); } }); $('.plus').click(function() { var curr = parseInt($(this).parent().find('.cdisp').html()); if (parseInt($('#spare').html()) > 0) { $(this).parent().find('.cdisp').html(curr+1); $('#spare').html(parseInt($('#spare').html())-1); } }); }); </script> Spare Points: <div id="spare">100</div> <div> <div>Campaign Name Priority</div> <div class="camp"> Campaign 1 <span class="minus">-</span> <span class="cdisp">0</span> <span class="plus">+</span> </div> <div class="camp"> Campaign 2 <span class="minus">-</span> <span class="cdisp">0</span> <span class="plus">+</span> </div> <div class="camp"> Campaign 3 <span class="minus">-</span> <span class="cdisp">0</span> <span class="plus">+</span> </div> </body> </html> How can I make it so that if I click and hold the mousebutton on either the plus or minus, the number will continue incrementing/decrementing without me having to click the buttons over and over? Thank you for any help in advance
  2. Wow! thats brilliant, thank you very much Works perfectly. I'm trying to figure out how it works, do you think you could explain it a bit for me? It's up to you, in either case, thank you very much and yes, I'm enjoying learning jquery very much.
  3. Hi guys, I'm new to javascript and am exploring jquery as it seems to make things very simple, though I am stuck on this one thing, I hope someone could help me. I have a input form that looks something like this Spare Points: 100 Campaign Name Priority Campaign 1 - 0 + Campaign 2 - 0 + Campaign 3 - 0 + I want to use the plus and minus buttons to deduct and add points to each campaign, deducted points get added back to the "spare points", points added to campaigns are taken from the spare points. As I press the plus and minus buttons the numbers need to change accordingly, the total number of points on the screen must only add to 100. I have very little idea where to start, I'm pretty new to jquery. Any ideas?
  4. Thanks for all your help smerny. That last piece of code didn't do the job. Instead I've found a way in my script of avoiding this pproblem all together by not having to have the boxes checked by default.
  5. Now when the page first loads $value1 will still be set to 0. When the page first loads the $_GET variable will not be set. Thus the !isset() clause returns true and $value becomes 0. I've tried all these things myself, this is precisely the problem.
  6. I know that. But when the page first loads $value will be set to '0'. I want it to be set to '1'.
  7. Smerny, I know I was assigning checked and unchecked before, I changed it to make it easier to understand. Thanks for all your helpso far, it's really appreciated, however in the code you've given me when the page first loads $value1 will be set to 0. It needs to be 1.
  8. I don't think you understood what I'm trying to do. Lets reduce to just one checkbox to make things simple. I want $value to be '1' when the checkbox is checked. '0' when the checkbox is unchecked. And '1' when the page first loads. Perhaps I'm being stupid, but I can't find a simple way to do that.
  9. I've tried googling it and I've looked around on the forum but I have another annoying checkbox problem. Say I have 3 checkboxes. They directly effect the data that is pulled from a database and placed on the same page. (the form and data are on the same page). By default all 3 boxes are checked. On the frontend I've just added the "checked=yes" attribute to each checkbox so they appear checked. On the backend I've just coded the following $value1="checked"; $value2="checked"; $value3="checked"; Trouble is when I uncheck the boxes the code doesn't process it properly. Since the checkbox's don't actually send a 'false' value, they just send nothing at all, so I use isset() to determine whether they are checked or not, like so. $value1="checked"; $value2="checked"; $value3="checked"; if(!isset($_GET['checkbox1']) { $value="unchecked"; } if(!isset($_GET['checkbox2']) { $value2="unchecked"; } if(!isset($_GET['checkbox3']) { $value3="unchecked"; } This doesn't work because when the page is first loaded the GET variables are not set, so the script puts all my $values to "unchecked" when I want them to remain "checked". I know I've described it in a bit of a confusing way. If you need any clarification just ask and I'll do my best.
  10. Yeah, I've looked really hard at it and I don't think there's anything wrong with it. The links are are fine. But the content isn't changing as you say. Everything points to there being something up with your getEntryRow() function. May I see it?
  11. Ok I've tried searching the forum and couldn't find quite what I was looking for I have a mysql database with about 15 fields, 4 of them are: com couk org net On the user interface, (my form) I have a 4 checkboxes for each, i.e com couk org net The user can check any, none or all of those checkboxes in order to filter the records they see for records where a .com domain is available or a .co.uk domain is available, or both, etc etc. I'm having trouble with the backend coding though. I'll illustrate with some code. If the user checks no boxes, the code is simple $sql="SELECT * FROM tkeywords"; The trouble is when they start checking boxes. If they check one box I need to use 1 WHERE clause, but if they do more than one I must use a WHERE clause first and then precede with AND statements. This is what I want to do $sql="SELECT * FROM tkeywords"; if(isset($_GET['com']=="on")) { $sql.=" WHERE com='1'; } if(isset($_GET['couk']=="on")) { $sql.=" WHERE couk='1'; } if(isset($_GET['org']=="on")) { $sql.=" WHERE org='1'; } if(isset($_GET['net']=="on")) { $sql.=" WHERE net='1'; } Of course that would only work if just one checkbox was selected, but if for example 2 where selected the SQL would end up as SELECT * tkeywords WHERE com='1' WHERE couk='1' which is incorrect and would not work, the second where clause and all after that need to be AND. Is there anyone who has had to do something similar and come up with an easy logic, or am I really going to have to write out a seperate sql statement for every possible combination of checkboxes on?
  12. perhaps then, ot wuld be better to simply delete it and see if it screws up your footer or not. If not, leave it out.
  13. who's script are you trying to reverse engineer?
  14. I can see you had great difficulty explaining that and I'm having difficulty understanding it. Do you have the script hosted somewhere, if you give us the URL along with all the code for it and then try and explain again what needs doing, we might be able to help.
  15. I second that, show us some code. This should not be a hard thing to do.
  16. can you please copy and paste the entire code and enclose them in code tags e.g: [code]use code tags like this without the space before the slash[ /code]
  17. Hi guys, I've got a problem. Here's my code: include("includes/sidebar.inc"); include("includes/connect.inc"); $sql="SELECT `name`,`status`,`intialdeposit`,`return`,`lastpaymentdate` FROM listings WHERE id=$_GET[id]"; $result=mysql_query($sql) or die(mysql_error()); $row=mysql_fetch_array($result); It just connects to a database, I know this all works. Now I've created an image using the GD library, so far so good, but now I want to write text onto my canvas so I used imagestring() like this: imagestring($im, 5, 27, 98, $row['name'], $textcolor); This seems to work fine, but if I take an integer value and try to draw that it doesn't work imagestring($im, 5, 27, 98, $row['monitoreddays'], $textcolor); $row['monitoreddays'] contains the integer 0 put it doesn't draw anything if I put imagestring($im, 5, 27, 98, '0', $textcolor); it works fine. Seems imagestring() has difficulties processing integers, how can I convert my integer value into a string?
  18. Hi I have a form where users are required to enter their Liberty reserve account number (liberty reserve is a payment processor) An account number always starts with the letter "U" followed by 7 digits. So an example would be U2581606 How can I check that a user has inputted a number in this exact format?
  19. That didn't quite work, heres my code and the output $date=date("Y-m-d"); echo "todays date ".$date."<br>"; $day_50 = strtotime($date . " -50 Days"); echo $day_50; Output: todays date 2009-05-08 1237420800 Thanks for your help so far, really appreciate the effort.
  20. so I have a date in the following format Y-m-d I want the date 50 days previous to it, is there a simple way to do this? The date must be returned all in numbers.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.