Jump to content

erme

Members
  • Posts

    188
  • Joined

  • Last visited

Everything posted by erme

  1. I set up this var prettyDate2 = (myDate.getDate()+1) + '/' + (myDate.getMonth()+1) + '/' + myDate.getFullYear(); $("#DepartureDate").val(prettyDate2); How would I adapt it to use set date?
  2. Hi, I have 2 inputs called ArrivalDate and DepartureDate using jQuery datepicker which needs to det the departure date at least one more day from the selected arrival date. All works fine, except when we reach the end of the month insted of the departure date rolling over to the next month it just +1's the date. Eg today its showing 31 April, which dosent exsist. $.datepicker.setDefaults({ changeMonth: true, changeYear: true, dateFormat: 'd/m/yy', firstDay: 1 }); var myDate = new Date(); var prettyDate = myDate.getDate() + '/' + (myDate.getMonth()+1) + '/' + myDate.getFullYear(); var prettyDate2 = (myDate.getDate()+1) + '/' + (myDate.getMonth()+1) + '/' + myDate.getFullYear(); $('#ArrivalDate').datepicker({ minDate: new Date(), onSelect: function(dateStr) { var min = $(this).datepicker('getDate') || new Date(); // Selected date or today if none $('#DepartureDate').datepicker('option', {minDate: min}); } }); $('#DepartureDate').datepicker({ minDate: new Date(), onSelect: function(dateStr) { var max = $(this).datepicker('getDate'); // Selected date or null if none $('#ArrivalDate').datepicker('option', {maxDate: max}); } }); $("#ArrivalDate").val(prettyDate); $("#DepartureDate").val(prettyDate2);
  3. I have 2 radio buttons. <input type="radio" name="toasted" id="toasted_sandwiches" value="Toasted Sandwiches" onclick="handleClick();" /> <input type="radio" name="toasted" id="toasted_paninis" value="Toasted Paninis" onclick="handleClick();" /> I want a function that only adds an event (in this case its spry validation) to what radio button is selected. Currently if the user clicks from one radio to the other, both spry events get called. function handleClick() { if (document.getElementById("toasted_sandwiches").checked == true) { var spry_toasted_sandwiches = new Spry.Widget.ValidationCheckbox("spry_toasted_sandwiches", {minSelections:3, validateOn:["change", "blur"]}); } else if (document.getElementById("toasted_paninis").checked == true) { var spry_paninis = new Spry.Widget.ValidationCheckbox("spry_paninis", {minSelections:3, validateOn:["change", "blur"]}); } }
  4. Hi, just tried it. It takes the size of the first image in img_wrapper and applies the class to the rest of the img_wrapper divs. So if the first image is landscape, the rest will be landscape regardless of the image size.
  5. I have a series of images in a div called .img_wrapper. I want to add a class to this div based on whether the image in the div is landscape or portrait. This is what I have come up with but doesn't work: $(".img_wrapper").each(function(){ var img = $(".img_wrapper img"); var div = $(".img_wrapper"); if (img.height() < img.width()){ div.addClass('landscape'); } else { div.addClass('portrait'); } });
  6. Can you give me an idea of how I would do this. The offer can be used on as many pages throughout the site as the user wants.
  7. Okay thanks for your replies. Basically what I am trying to achieve is the ability for the user to be able to edit a page on a website (this bit I have done, using 'update pages') and select from a drop down box an offer that appears in the SQL table 'offers'.
  8. They arn't. I just want to pull data from both to display on the same page.
  9. Hi, bit of a newbie question. I have a table called pages. I select all from this table. I need to also show the rows of another table called offers so the user can select an offer to display on this page. Question is, how do I select from both tables. pages table colums: ID Name Copy offers table columns: OffersID OffersTitle OffersDate OffersCopy OffersType OffersPrice I have tried variations of the below but does not work: SELECT * FROM pages WHERE id = '" . $id . "' LEFT JOIN offers
  10. Perfect, however is there an obvious reason why it wouldn't work in IE? Actually it does. I'm just being stupid!
  11. Hi, I have a input with a number as a value, say 1.55. I want to allow the user to be able to increase the number but not decrease it. Is this possible? Many thanks.
  12. Perfect! Thanks both of you. This worked!
  13. Hi, I currently have one table with a column called box, which will have values of 'one', 'two', 'three' etc. There will be 8 boxes to display on the site. The site needs to display the newest row according to column added (which will have the date added as a value). I am thinking of writing the code below to populate the 8 boxes: while($row1 = mysql_fetch_assoc(mysql_query("SELECT * FROM table WHERE box = 'one' ORDER BY added DESC LIMIT 1"))) { //echo box 1 } while($row2 = mysql_fetch_assoc(mysql_query("SELECT * FROM table WHERE box = 'two' ORDER BY added DESC LIMIT 1"))) { //echo box 2 } while($row3 = mysql_fetch_assoc(mysql_query("SELECT * FROM table WHERE box = 'three' ORDER BY added DESC LIMIT 1"))) { //echo box 3 } while($row4 = mysql_fetch_assoc(mysql_query("SELECT * FROM table WHERE box = 'four' ORDER BY added DESC LIMIT 1"))) { //echo box 4 } etc.... Is there a better way to streamline this? Many thanks
  14. Just worked it out. 2008-11-11 12:45:34
  15. Thanks for your reply. What format will the date and time need to be stored as for this to work? Currently it is stored like this 2013043014:14:35
  16. Hi, I've created a CMS that enables the user to publish an article which will appear on the site immediately. I need to add in the option to schedule displaying the article. I have a field in the MySQL table for pubished_date. How can I write something in PHP that won't display articles where published_date is in the future / hasn't arrived yet? I could then maybe set up a cron job to run the script every night. Thanks in advance...
  17. Got it working myself preg_replace(array('/[0-9]/'),array(''), $title);
  18. So something along these lines? $title = preg_replace( array('text', '%\0-9/%'), array('', ''), $crumb);
  19. Looking to remove text* where * will be a number. The below doesn't work. Can anyone shed some light? str_replace(array('text[0-9]'), Array(''))
  20. Hi, I only want a bit of javascruipt to run when window width is larger then 768px. In other words, for mobile devices I dont want it to load. This needs to work when resizing the browser window. var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); }; })(); $(function() { var pause = 100; // will only process code within delay(function() { ... }) every 100ms. $(window).resize(function() { delay(function() { var width = $(window).width(); if( width >= 768 ) { var carouselOptions = { auto: true, btnNext: "#quicklinks_right", btnPrev: "#quicklinks_left", visible: 4, speed: 1000, pause: true, responsive: true }; $('#quicklinks').jCarouselLite(carouselOptions); $("ul.sf-menu").superfish({ animation: {height:'show'}, // slide-down effect without fade-in delay: 800 }); } else if( width <= 767 ) { $('#quicklinks').unbind(); // not sure if this works? $("ul.sf-menu").unbind(); // not sure if this works? } }, pause ); }); $(window).resize(); });
  21. Works perfectly. Thanks very much!
  22. Thanks I'll give these a go
  23. <?php $uri = $_SERVER['REQUEST_URI']; $directory = $_SERVER['DOCUMENT_ROOT'].'/img/banner' . $uri . '/'; $images = glob($directory . "*.jpg"); foreach($images as $image) { $test = explode("/" , $image); echo "<pre>".print_r($test)."</pre>"; echo '<img class="slide" src="' . $image . '" alt="">'; } ?> Basically it gets all .jpg files from a folder as per the URI. I need document root to call the folder, but don't want it to render the image in HTML
×
×
  • 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.