Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. I did finally get it to work. I found this article... http://stackoverflow...te-is-it-useful <input type="file" id="infile" onchange="handleFile(this);" accept="text/*,.csv"></input> Now why does a comma work when I think you are supposed to use a vertical bar?
  2. Well, I can't even use this to filter the choices that show up in the popup file selector. I am looking here: http://www.w3schools...nput_accept.aspandhttp://www.iana.org/...text/index.html But I can't get *.csv files to show up in Chrome unless everything else does. input accept="text/csv" shows all files and "text/*" does not show *.csv files.
  3. davej

    HTML5 SQL

    Has anyone here used this much? The example I have looks a bit odd. var sqlQuery = 'SELECT * FROM emptable';mydb.readTransaction( function(tx) {tx.executeSql( sqlQuery, [], successFunct, errorFunct);}); Especially stuff like this... var sqlCmd3 = 'INSERT INTO departments(deptname) VALUES (?)';var sqlItem1 = 'Accounting';var sqlItem2 = 'Engineering';var sqlItem3 = 'Production';mydb.transaction( function(tx) {tx.executeSql( sqlCmd3, [ sqlItem1 ], nullHandler, onDbError);tx.executeSql( sqlCmd3, [ sqlItem2 ], nullHandler, onDbError);tx.executeSql( sqlCmd3, [ sqlItem3 ], nullHandler, onDbError);});
  4. I am experimenting with a page intended for a mobile device. I have set up... <style media="screen">#container {width: 800px;margin: 0 auto;}#mapCanvas {width: 800px;height: 500px;border-style: solid;border-width: 1px;margin: 22px 0;}</style><style media="handheld, only screen and (max-device-width: 480px)">#container {width: 100%;}#mapCanvas {width: 100%;height: 200px;border-style: solid;border-width: 2px;margin: 22px 0;}</style><style>...</style> Is that going to work or not? Thanks
  5. I'm guessing you are talking about a standard MSSQL Server or MySQL database on the client side. You may know that HTML5 offers a client-side SQL database API but this has no connection to standard databases. You might look into using a signed Java Applet. HTML5 can also talk to local files so maybe it could use files to communicate with a desktop program.
  6. In my code I have not had any use for the onsubmit event. When my javascript initializes I just change the submit button into an ordinary button and then have the onclick event call the validation function which may or may not submit the form. But I would like to understand this example... http://www.w3schools.com/js/js_form_validation.asp Apparently onsubmit="return function1()" gives function1 the ability to cancel the submittal by returning a false value. Is this approach in any way better than what I am doing? Are there yet other ways to control form submittal on the client side? Thanks.
  7. I don't see it described here... so maybe it is HTML5 specific... http://www.w3schools..._obj_regexp.asp ...but I am trying to use file.type.match(regex_pattern) with a complete lack of understanding.What does this test tell you? I was just trying to read in a .csv text file. My example code shows... function handleFile(inputFile) {var csvMimeType = /text\/csv/;var file = inputFile.files[0];//verify the file is a csv fileif ( file.type.match(csvMimeType) ) {alert('accept');}else{alert('reject');}...} After struggling with various other regex values from other examples I finally bypassed the test and got a result that says: File type: application/vnd.ms-excel So is this baloney test feature just testing the file association for the .csv file extension? If so that is just worthless garbage. Perhaps .csv files are associated with Excel on this machine, but who cares? I see the match feature is used in the following examples... http://msdn.microsof...7(v=vs.85).aspx and http://www.htmlgoodi...filereader.html What good is identifying the associated application inside Javascript? In my situation I just want to make sure the file extension is .csv and that the contents of the file do not contain non-text characters. Shouldn't that be the goal?
  8. Yes, I didn't think that plugging a bunch of code into innerHTML was considered standard practice. Aren't you supposed to use createElement()?
  9. I have been wondering about that myself, but so far I have not needed to figure it out. Onchange? Mouseup?
  10. Oh, that was just an example of the sequence of events -- of going three deep and then popping back to the starting point.
  11. Well, is that maybe my problem? When you use pushState() does the specified state get pushed or does the current state get pushed? In order to insert the time of the push maybe I need to use replaceState() to insert the time and then use pushState()?
  12. I guess you found this one? http://www.w3schools.com/js/default.asp
  13. Interesting. Yes I noticed later that some of the date format options looked similar to the datetime attribute. I also noticed that the toLocaleString() format is very nice. Apparently I forgot to use getAttribute() and that is why I couldn't read it. Thanks.
  14. I don't think you would want to use a timer because that would be a fake progress indicator. You could simply modify your script so that in the outer loops it writes a percentage value or the traditional asterisks to a progress span to provide a real indication of progress. Status: <span id="jsstatus"></span> <!-- Javascript sets this to "WORKING" --><br/>Percent complete: <span id="jsprogress"></span>%<br/> <!-- Javascript sets this --> You could use a row of little images if plain old asterisks are too boring.
  15. I am looking at some example code that uses Javascript to create entries in a div that each include buttons with onclick calls to javascript functions. This seems like a hack to me but I can't see what the alternative is. Consider a list of text entries that each have their own "delete" and "update" buttons. Isn't that sort of creepy?
  16. Yes, but the idea is to check your structure while you are working on your page. The fact that <article> and <section> and <header> can be mixed in so many different ways there is a lot of confusion.
  17. Anyone have a firm understanding of the for= attribute and where it is needed? I see it used here: http://www.w3schools...s/tag_label.asp but where I seemed to need it was here: http://www.w3schools.../tag_output.asp where I wanted to break the form tag away from the oninput creating this... <!DOCTYPE html><html><body> <form name="form1"><for="" oninput="x.value=a.value"/> <!-- for="form1" ??? --><input type="range" name="a"/>= <output name="x"/> <!-- for="a" ??? --> <!-- </output> ??? --></form> </body></html> But I'm not sure how many items in this form need for= attributes or what they should be set to. The original code uses a for= in the output element but it seems to work without it in Chrome. There is also the confusion of these HTML5 scriptlets. When an event fires who executes first, the HTML5 scriptlet or the Javascript event handler? I mean are these scriptlets only creating displayed values or will they feed values to the form submission or Javascript? http://www.w3schools...tattributes.asp
  18. So I was reading about how virtualization is a critical technology that makes fault-tolerant server clusters possible. Does anyone (or everyone) here have experience with this stuff? http://www.vmware.com/products/datacenter-virtualization/vsphere/overview.html
  19. With the unexpected death of a harddrive I've lost a lot of my notes on html formatting (along with all of my Adobe software). I usually set up my very simple pages with a centered div wrapper of a defined width but now I am now playing with HTML5 and seem to be getting some odd results mixing in <article> and <section> tags. I ran into a situation where I had a short right column where the background-image stopped where the <aside> ended. I wanted the background-image to fill the wrapper, but that didn't seem to work. In other words my <aside> column was shorter than shown here... A second problem I've had -- how can I add a wrapper div around existing structure without having any effect on the formatting of that internal structure? Thanks.
  20. Found this article... https://developer.mozilla.org/en-US/docs/DOM/Manipulating_the_browser_history All I wanted was a timestamp. Is there a sizeof I can use on objects?
  21. Yes, the strange thing is that it seems to work, but there is something that isn't quite working. I probably need to verify the legal parameters that can be used with history.pushState(). The example seems to show that the parameters are an object, a page title, and a path. Perhaps there are restrictions on the object? I decided to put the current time in the object but maybe that can't be done.
  22. I am still having issues with this feature. I would think that the proper sequence would be: history.replaceState(...) /* initialization */history.pushState(...)history.replaceState(...)history.pushState(...)history.replaceState(...)history.pushState(...)history.replaceState(...)history.back()history.back()history.back() But somehow this isn't working right, because although I push known objects onto the stack, I don't see same pushtime field later when I pop. function go(){var d = new Date();var savedStateObj = { page: currentPage, pushtime: d, previous: previousPage };alert('pushState:' + JSON.stringify(savedStateObj) + '[Page' + currentPage + ']' + "?page=" + currentPage);history.pushState( savedStateObj, 'Page ' + currentPage, "?page=" + currentPage);}window.onpopstate = function(event) { //history pop state handlerif (event.state !== null) {alert('popevent: state:' + JSON.stringify(event.state));}}
  23. I'm not having much luck taking a date from HTML5 and getting it into Javascript. I have a date picker working in Chrome but how do I get that date accurately into Javascript? http://www.w3schools...me_datetime.asp http://www.w3schools...js_obj_date.asp <time id='time1' datetime="2012-11-23T01:00Z">Fri Nov 23 2012</time><form><label for="date">What date will this article be published?</label><input class="hasDatepicker" required="" id="date" name="date" type="date"><input value="Submit" type="button" id="datebtn"></form> Ok, I have something that sorta works, but I still can't read the datetime field in Javascript. I don't understand what, if anything, connects the datetime field to the displayed value, or how you generate and set the datetime field. function fndate(){var str1 = document.getElementById('date').value;var n = str1.split("-");//alert(n[0]+' '+n[1]+' '+n[2]);var d = new Date();d.setFullYear(n[0],n[1]-1,n[2]);document.getElementById('time1').innerHTML = d.toDateString();}
  24. The book I am reading recommends the Chrome extension shown below... https://chrome.google.com/webstore/detail/html5-outliner/afoibpobokebhgfnknfndkgemglggomo ...but I never see the icon when I am looking at a local file I am working on. I only see it on hosted webpages. Why would it care if it was looking at a file or a hosted webpage?
×
×
  • Create New...