Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by haku

  1. Traditionally, yes. But HTML5 introduces the 'form' attribute for form elements, which allows for the form element to not be a child of the <form> tag. Ex: <form id="someform"> <input type="text" name="some_key" /> </form> <input type="submit" form="someform" value="Submit the form" />
  2. You can also do: function someFunction(bob){ bob = bob || true; //... }
  3. Interesting idea. They would have to be scanned very regularly to keep the count current. The method I have is a little more reliable I think. But thanks for the input.
  4. I got it! I didn't figure out how to call a script in the background, but what I did was create a callback PHP script, which instead of returning the image in an image tag, serves the image directly to the browse using a force download script, setting the relevant headers etc. Now my PHP script behaves the same as when directly accessing an image, and I am able to mark the image as having been viewed before serving the image to the browser.
  5. I guess another way to explain it is that I'd like to call a PHP script in the background when files of a certain type are accessed. I want this to happen automatically through some configuration of PHP or .htaccess (or some other server config).
  6. Thanks for your reply, but the answer doesn't match the question at all. I'm not looking to detect screen size, I'm looking to call a PHP script when directlly accessing an image file.
  7. I'm working with a lightbox plugin to show images when thumbnails are clicked on. The plugin works by wrapping the thumbnail in an anchor tag that has the href as the direct path to the full-size image. This acts as a non-js fallback, so that if JS isn't present for whatever reason, the user still sees the image. When JS is enabled, the image is shown in the lighbox, resized to fit in the lightbox, which is a variable size depending on the browser. I need to keep a record of the number of times that the image has been clicked on, as thumbnails will be ordered by the number of views. The problem of course is that I'm directly linking to the image, so I can't put a script on this page. I've tried two things instead, neither of which worked: 1) Instead setting the target as the path to the image, I set it to a PHP script, then outputted the image in an <img/> tag. The problem was that the image is then not resized according to the size of the lighbox. So this is no good. 2) I set the target of the lightbox as a PHP script which recorded the viewing of the image, and redirected to the image page. This didn't work either, as the lightbox showed the data for the image (text) instead of the image itself. So, I've hit a bit of a barrier. I'm wondering if I can set something up in my PHP settings that will automatically call a script when hitting images, or maybe something in an .htaccess file that will do the same, but I'm not aware of if this can be done, nor how to do it, and I haven't found anything yet with my googling. Does anyone have any thoughts? Thanks.
  8. Actually, local storage is a replacement for cookies that can be used for storage for javascript. Cookies are becoming outdated with javascript now.
  9. Wow, four times people posted either window.open() or a link to an article that uses window.open() to create a new window. Three times Gristoi mentioned that that method is extremely outdated, and yet someone still posted it. Let me help you people: WINDOW.OPEN() IS OUTDATED AND A DECADE OLD.
  10. I think you are looking for 'faux columns'. Google it, and you should get your answer.
  11. When sliding down, you can set onclick on the page body, setting it to hide the menu in question. However, you will have to do two other things as well: 1) Set the event to not propagate (bubble) when the menu itself is clicked on (or else the menu will hide when you click on it) 2) Remove the onclick from the body when the menu is hidden again.
  12. You need to also implement window.popstate(). history.pushstate() adds to the history, history.popstate() loads your page when you change your history.
  13. I've never done jQuery AJAX the way you are doing it, and it may have something to do with the issue. I always use the following pattern: $.ajax({ type: 'POST', url: URL_SEND_MESSAGE, data: ($(form).serialize() + '&include_markup=true'), dataType: 'json', success:function(data) { // Success stuff here }, failure:function(data) { // Failture stuff goes here } }); Anyways, I'm glad it worked for you the way I showed. Weird error.
  14. You mean the jQuery plugin, jQuery UI? I did miss that he had said it's from that plugin though.
  15. You didn't tell us what you are trying to do, or what is happening now.
  16. $.sortable() is not a jQuery function. Which likely means this is a plugin. If so, then you need to go to the plugin developer, as it is unlikely that any of us will know the internals of this fucntion.
  17. Try changing this: $(data.markup).hide().appendTo('#messageContainer').fadeIn(500);To :$("<div/>").html(data.markup).contents().hide().appendTo('#messageContainer').fadeIn(500);If you're lucky, it will bypass the problem. Ideally, passing the returned data through the $.html() function will parse it differently than passing it through the base $.() jquery function (which is what you are currently doing). Can you show more of your code? Where exactly is the code that you showed us located? I'm assuming it in the callback of one of jQuery's Ajax functions, but maybe that assumption is mistaken. The return headers indicate that you are getting what you are asking for - utf-8 with a JSON mime type. So that's not your problem there. One other thing you could maybe check is the encoding of the document of your script. For example, if your document itself (*.php) is encoded in a non-utf-8 encoding, it may be having issues with the utf-8 encoding of the return data. If none of that works, do a call to console.log(data.markup); and open a javascript debugging console. That will give you a better idea of what the returned data looks like so you can maybe debug the issue.
  18. Dreamweaver provides it's own proprietary templating system. I got passed a site that used them one time - huge pain in the a$$.
  19. You should change that to this: <a href="#" name="menu_1" onclick="change_menu(this.name);">Home</a>
  20. Show us the output you want, and the output you are getting.
  21. There is a payoff - if you could do it like PHP (a 'loose' language), then it would require more overhead, slowing things down. By having to declare each element, there is less overhead, making for smoother running scripts.
  22. I actually prefer your method - it's clearer as to what is happening when you are looking at the end of the code.
  • 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.