Jump to content

squigs

Members
  • Posts

    135
  • Joined

  • Last visited

Everything posted by squigs

  1. Hello, I am building a navigation bar with sub menus which appear when the main item is clicked and disappear when the user clicks elsewhere. I have read numerous posts concerning this topic but I'm not sure how to implement it. My code is as follows: topNav.js <script> var timeout = 50; var closetimer = 0; var ddmenuitem = 0; // open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if (ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if (closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // need to somehow close layer when click-out </script> Html <body> <div id="main_nav"> <ul id="nav"> <li class="nav"><a href="#" onclick="mopen('m1')"> <span class="nav_parent">CONTACT US</span></a> <div id="m1"> <a href="#">General Inquiries</a> <a href="#">Request a Quote</a> <a href="#">Submit Plans</a> <a href="#">Submit Photos</a> </div></li> </ul> </div> </body> An example of this is at http://jsfiddle.net/schwiegler/t859A/21/
  2. And I'm still trying to pass grade eight
  3. Typically if you do as DavidAM has suggested and create your form so it is working without client side validation and then add your javascript for client side validation afterwards what will happen if you write your validation code correctly is that the server side validation will not ever occur. Essentially is a user leaves a field blank and you have written form validation that does not allow that, the process will never be carried out in the server side thus the error will not be repeated. You will notice if your javascript is not written correctly you will end up for example seeing a javascript alert followed by your server side error message as well. In otherwords if you are doing it right the front end validation will stop the back end from happening. I hope that explains it a bit better otherwise you may have to be a bit more detailed in your question.
  4. Not to mention think of all the people who use phones. The phone are smart but people aren't. Think of all of the posts you've seen on php freaks forums of people who say "it's broken" (hopefully I'm not the worst offender) but with no idea of what they are actually doing. Now picture those same people in the cell phone stores with the phone they had root access to extended in their hands "it's broken..." It is the whole idea of companies trying to make the one-phone-fits-all solution and unfortunately that usually means dumbing it down. I do feel that they shouldn't go to great lengths such as apple to prevent people who want raw access to the phone's capabilities.
  5. I used to be a bit paranoid about it. Now I just wish I owned their market shares.
  6. I guess there's a little bit of that in everything these days. Well everything you have to purchase anyways. It's understandable why it's done (profit) but you need the hindsight to see the limitations and downfalls sometimes as well as the potential for new ideas. Everyone wants to be a giant and whoever can set the initial tone to steer the market in that direction can only be on top for so long before others adapt new ideas from what's been developed. If they were out to please everyone they would have to be open sourced and that means free.
  7. That's why I give the nod to their terms and when they turn their backs...
  8. Hipster... I am so not a hipster. Don't even get me started on hipsters. Jokes.. I use an iphone (although its an old 3g) I'm just proud that I haven't lost/broken it in 3 years...
  9. Thanks for the input! 9% is still a large number of people using ie7 although I have to wonder, if a user is using an out of date browser how likely is it that they would be shopping for goods/services online vs. checking emails and updating themselves on daily news etc. I can't help but think it could be an older population that is stuck on older browsers as they are less tech savvy and less likely to want the latest/greatest. Of course that is just a generalization but if it were to bear any truth to it the methods used to design a website relies heavily on the audience you are targeting. I wonder what the web analytics would look like for a site like php freaks.
  10. I don't claim to be a professional by any stretch, my target audience generally would be a local one. From what I see looking at the stats only about 0.6% of Canadians still use ie6 so that's one I would ignore completely. (My current site looks like shit on it anyways) But I may have to look deeper into fixing things up for ie7 because it renders much in the same way as 6 did.
  11. So here we are entering the latter part of 2012, HTML5 is on the rise and the most popular browser creators have given their heads a shake and are now coming together to (more or less) standardize HTML/CSS to the relief of web designers and programmers. With that said, we are still in the midst of the transition period so I would like to poll the community and ask which browsers across which platforms should web designers be targeting to achieve proper displays and functions? The question arose for me after I decided it was time to do a broader test on my own current site. I typically have the latest of the big three installed for local testing purposes, those being Firefox, Chrome and IE. I also have Safari installed and check on the ipad and iphone from time to time. I figured I would take it a step further and google cross browser testing and came up with a couple free solutions online. In running these tests I found out a couple of things. There are many more browsers available than I had anticipated and for the most part my site quite consistent across most with a few exceptions. So I'll turn it over to this community to get your thoughts on which browsers are a must for considerations and where to draw the line when looking at backwards compatibility. Cheers
  12. Those are the ones, just thought i'd point it out.
  13. Got it sorted out! I ended up using this to get my desired result. var addFile = document.getElementById('addFile'); addFile.onclick = function addFile() { if (this.count == undefined) { this.count = 0; } if (this.count++ < 4) { $("td.files").append('<tr><td><input type="file" name="uploaded_file[]" class="file_input" size="46" style="margin-top:3px;"/><a class="delete" href="javascript:void(0)" style="color:blue; padding-left:15px;">Remove File</a></td></tr>'); } };
  14. Hope everyone is doing well, I'm trying to append items with javascript but limit the amount of times they can be appended. Currently I am using this to add the items with no limit. $(".add").click(function() { $("td.files").append('<tr><td><input type="file" name="uploaded_file[]" class="file_input" size="46" style="margin-top:3px;"/><a class="delete" href="javascript:void(0)" style="color:blue; padding-left:15px;">Remove File</a></td></tr>'); }); I have been playing with the following but am unable to get it functioning: var count = 0; $(".add").onclick = function(e) { if (count >= 4) { return false; } else { count++; $("td.files").innerHTML += '<tr><td><input type="file" name="uploaded_file[]" class="file_input" size="46" style="margin-top:3px;"/><a class="delete" href="javascript:void(0)" style="color:blue; padding-left:15px;">Remove File</a></td></tr>'; } }; I have also tried assigning IDs instead of classes and using document.getElementById to no avail. am I doing wrong here? Thanks
  15. Hello getting 404 messages when using links from home page under popular forum boards I believe it's titled.. Just giving the heads-up. Cheers
  16. I strongly disagree with this quote. Sorry, just got a parking ticket :'( Best quote on this thread!
  17. With a teflon skillet? Well it looks as though that would be the one for the job...
  18. This sounds like more of a php solution rather than css... I personally still like using links the old fashioned way.
  19. could you not wrap it all in a div with one id that triggers the onhover?
  20. Hi I'm attempting to validate a file input field against duplicate entries. It looks something like this: <input type="file" name='uploaded_file[]' class="file_input" id="uploaded_file" size="46"/> The problem is that this input can be recreated several times through javascript,repeating the same name, class and id. I'm not sure of the proper way to validate against the new fields. The code used to duplicate these fields is below: $(".add").click(function() { $("td.files_e").append('<tr><td align="left"> <input type="file" name="uploaded_file[]" size="46" class="file_input" id="file_upload"/> <a class="delete" href="javascript:void(0)" style="color:blue; padding-left:15px;">Remove File</a> </td></tr>'); }); }); Thank you for any help you can provide!
  21. Done! (and it works too) I will note the changes in case it helps someone else.. foreach ($_FILES["uploaded_file"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["uploaded_file"]["tmp_name"][$key]; $name_of_uploaded_file =($_FILES["uploaded_file"]["name"][$key]); $type_of_uploaded_file = substr($name_of_uploaded_file, strrpos($name_of_uploaded_file, '.') + 1); $size_of_uploaded_file = $_FILES["uploaded_file"]["size"][$key]; $temp_path_of_uploaded_file = $upload_folder . $timestamp . $name_of_uploaded_file; //this is where I appended the timestamp //copy the temp. uploaded file to uploads folder if(is_uploaded_file($tmp_name)) { if(!copy($tmp_name,$temp_path_of_uploaded_file)) { $errors .= '\n error while copying the uploaded file'; } $path_of_uploaded_file[] = $temp_path_of_uploaded_file; } } }
  22. Good thinking! I should be able to accomplish that. Thank you
  23. Hi I've created a form that accepts multiple attachments. It is looking/working better everyday with a little help from the folks at php freaks! In testing the script and using the same files over and over I realized that unique file names were not being assigned to the uploaded files. I am looking for some advice on how to handle this. I will post relevant code to give an example of the variables I have in use. foreach ($_FILES["uploaded_file"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["uploaded_file"]["tmp_name"][$key]; $name_of_uploaded_file =($_FILES["uploaded_file"]["name"][$key]); $type_of_uploaded_file = substr($name_of_uploaded_file, strrpos($name_of_uploaded_file, '.') + 1); $size_of_uploaded_file = $_FILES["uploaded_file"]["size"][$key]; $temp_path_of_uploaded_file = $upload_folder . $name_of_uploaded_file; //copy the temp. uploaded file to uploads folder if(is_uploaded_file($tmp_name)) { if(!copy($tmp_name,$temp_path_of_uploaded_file)) { $errors .= '\n error while copying the uploaded file'; } $path_of_uploaded_file[] = $temp_path_of_uploaded_file; } } } Thank you again!
  24. I have posted a continuation to this in a new topic as it is no longer relevant here. Marking this as solved although I hope an actual solutions arises soon!
×
×
  • 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.