Jump to content

vmars316

Members
  • Content Count

    431
  • Joined

  • Last visited

Posts posted by vmars316

  1. If it helps, both of these create the same result
    localStorage.setItem('myKey', 'myData');localStorage.myKey = 'myData';

    I see . Thanks . This one thru me :
    localStorage.myKey = 'myData';

    Because myKey wasn't defined anywhere , and it seemed that since it is used as a literal , it should read localStorage."myKey" .That's an unexpected syntax for me .

    I'm not sure what you mean by "a multi-part KEY." That's what I thought I was showing you when I mentioned JSON, but perhaps it's not.

    By "multi-part KEY" I mean , the KEY is composed of ( "myDiary_" + TodaysDate ) , so KEY would look like : [myDiary_2013.01.28] . So , in my code , when user does a Click on [OpenToday'sPage] Button , I would check if there is already a 'Page for Today' .If there is , then code would load DATA into Textarea1 . If not , then an alert might say "This is Today's Page , Please enter your data. " . ...vm

  2. Thanks :

    Why does it matter what the browser names the files?
    It matters because I am trying to learn about the Beast called localStorage ."Why does it matter what the browser names the files?"Oh , that's new information to me "the browser names the files" ...Thanks And I also learned that :The browser (in my case Chrome Version 24.0.1312.52 m ) names the files according to what is the current/active site .For example when I issue a 'localStorage command' from here :http://www.w3schools...me=tryjs_eventsThe browser names the files : http_www.w3schools.com_0.localstorage http_www.w3schools.com_0.localstorage-journal and here : https_plus.google.com_0.localstorage https_plus.google.com_0.localstorage-journal and for my desktop : __0.localstorage __0.localstorage-journal etc..
    The key is the name of the data, like a variable name or cookie name. It is how you refer to the data when you're asking the browser to save or retrieve it.
    Thanks
    You can use localStorage.getItem('myKey') to get the data, that's how you use the key.
    Thanks
    Where and how the keys and data actually get stored by any arbitrary browser really isn't relevant.
    It matters to me , because I would like to go thru the "Local storage" Folderand delete everything out there .
    For Chrome specifically, the files it saves are SQLite files
    Yes , I noticed that . I was wondering why at the beginnning of each file it reads "SQLite format 3" .Does that mean that Chrome installed SQLite onto my computer ?
    Thanks , after I get localStorage working , I will check it out . Thanks again...Vernon BTW : Deirdre's DadI wasn't being sarcastic : sometimes I get lost in a conversation , and forget what was said before .
  3. When I use your code , it creates the following 2 files :__0.localstorage__0.localstorage-journal When I substitute your line : localStorage.test = JSON.stringify(obj);with mine : localStorage.setItem('myKey', 'myData');the code creates the following 2 files : https_plus.google.com_0.localstoragehttps_plus.google.com_0.localstorage-journal I was expecting the files created with my code to be named :myKey.localstoragemyKey.localstorage-journalWhy aren't they ? Like I said , I need to understand what KEY means ,& where does KEY show up ?Also, which file contains the KEY ?Also, which file contains the DATA ? See code below :THanks...Vernon <!DOCTYPE html><!--__0.localstorage__0.localstorage-journal--><html><title>~~~localStorage-01.html</title> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <title></title> <script type="text/javascript"> function init () { document.getElementById("button1").onclick = function () { var obj = new Object; obj.key = "val";' localStorage.test = JSON.stringify(obj); localStorage.setItem('myKey', 'myData'); } document.getElementById("button2").onclick = function () { var newObj = JSON.parse(localStorage.test); alert(newObj.key); } } window.onload = init; </script> </head> <body> <div> <input type="button" value="Set" id="button1"> <input type="button" value="Alert" id="button2"> </div> </body></html>

  4. Hello & Thanks ,I would like to write a myDiary script . But I am having trouble with the concept of KEY . Normally , when I think of a KEY , as applied to data ,I think of it as an Index pointing to something . Givens :TodaysDate="2013.01.27" .And "myDiary_" is a constant .Then of course there is a TextArea1 full of text . I would like to Create a Key for localStorage ,consisting of ( "myDiary_" + TodaysDate) . [ myDiary_2013.01.27 ]How would I do that with localStorage :localStorage.key=( "myDiary_" + TodaysDate) I plan to run script like this :Each time the user clicks on [New Entry Button] .script checks if there is an entry for ("myDiary_" + TodaysDate) .If ("myDiary_" + TodaysDate) is there , script loads data into Textarea1 Eventually user will click on [save/Update Button] .And new data is added to ("myDiary_" + TodaysDate) . I also notice that for every entry in :C:\Users\me\AppData\Local\Google\Chrome\User Data\Default\Local Storage There are two files , for example :First the -journal : https_plus.google.com_0.localstorage-journalThen this : https_plus.google.com_0.localstorage ? What is the difference between the two ?and? How to create a multi-part KEY ? Thanks...Vernon

  5. * Hello & Thanks , Is there such a thing as 'CrossPlatform Desktop PHP' ?Normally I program in HotBasic (freeware programs) .But I am interested in crossplatform . So it seems like javascript and php are quite platform independent . Today I noticed a Php-Gtk crossplatform opensource package .I would like to write programs that run in Browsers ( IE , chrome , firefox , etc. ) . And I need to use the FileSyatem , for *.txt files . I know IE's *.hta can do this , but it is for IE only .So I am looking for the smallest Desktop footprint possible , to develop php/html/javascript programs . And more importantly , I am looking for the smallest Desktop footprint possible , to run these programs in . Any advice/direction you can give me will be greatly appreciated . Thanks...Vernon

  6. I am trying to Include an external file inside of HTML that will work as crossBrowser: I have come up with three methods of coding it, but only Chrome works for all 3 methods.Anyone know of different ways to do this ?Thanks...Vernon Including an external file inside of HTML: In the 3 methods below , for GoogleChrome, all Methods(1,2,3) work ,and all methods show search results. For InternetExplorer, all Methods(1,2,3) show something ,BUT ONLY 'Method 2' shows search results. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Minimalist Html Code</title> </head><body><br><br>Method 1<br><embed src="C:\Users\vm\Desktop\myPrograms\~PortableFreeware.com\AkelPad\~~~Scratch.txt"><br><br><br>Method 2<iframe src="C:\Users\vm\Desktop\myPrograms\~PortableFreeware.com\AkelPad\~~~Scratch.txt" width="800" height="800"><a href="C:\Users\vm\Desktop\myPrograms\~PortableFreeware.com\AkelPad\~~~Scratch.txt">Hmm, you are using a very old browser.Click here to go directly to included content.</a></iframe><br><br><br>Method 3<object width="800" height="800" data="C:\Users\vm\Desktop\myPrograms\~PortableFreeware.com\AkelPad\~~~Scratch.txt"></object> <br> <br></body></html>

  7. Look here. The second example comes closest to what you want.
    Ah, yes, good aim.Which led me to : http://www.w3schools.com/js/js_ex_dom.asp http://www.w3schools.com/js/js_examples.asp But I am not asking 'how to open a window'. I am saying 'given the code above', (see line 30.) He uses no OPEN , and still he manages to open a window,or at least clear orig window, then writeln to print a receipt. Anyways, Thanks for the link...vmars316 almost forgot, I combine both openWindows into one, in case there are other newbies, like me reading here:<html><!-- http://www.w3schools.com/jsref/met_win_open.asp --><head><script type="text/javascript">function openWin(){myWindow=window.open('','','width=200,height=100');myWindow.document.write("<p>This is 'myWindow'</p>");myWindow.focus();}function open_win() {window.open("http://www.w3schools.com");}</script></head><body><form><input type="button" value="Open little window" onclick="openWin()" /> <input type=button value="Open URL Window" onclick="open_win()" /></form></body></html>
  8. Greetings;In the following, what causes the js to create a new page, for writing the "document.writeln" onto: 31: document.writeln("Price: $" + total_price + "<br>");....Thanks...vmars316---START--1: <html>2: 3: <head>4: <title>JS input example.</title>5: <script language="JavaScript">6: <!--7: /* Start of round_total function.8: */9: function round_total © {10: var pennies = c * 100;11: pennies = Math.round(pennies);12: var strPennies = "" + pennies;13: var len = strPennies.length;14: return parseFloat(strPennies.substring(0, len - 2) + "." + strPennies.substring(len - 2, len));15: }16: // End of round_total function.17: 18: /* Start of generate_page function. */19: function generate_page (form) {20: tax = 0.08;21: delivery_p = 2.99;22: var odate = new Date();23: var qty = form.quantity.value;24: var product_v = new String(form.product.value);25: var total_price = product_v.substr(product_v.indexOf("$") + 1, product_v.length - product_v.indexOf("$"));26: var price_without_tax = round_total(qty * total_price);27: var ttax = round_total(price_without_tax * tax);28: var delivery = round_total(qty * delivery_p);29: var total_p = round_total(price_without_tax + ttax + delivery);30: document.writeln("Quantity: " + qty + "<br>");31: document.writeln("Price: $" + total_price + "<br>");32: document.writeln("Tax: $" + ttax + "<br>");33: document.writeln("Delivery: $" + delivery + "<br>");34: document.writeln("Total: $" + total_p + "<br>");35: document.writeln("Order placed on: " + odate.toGMTString());36: }37: // End of generate_page function.38: 39: -->40: </script>41: </head>42: 43: <body>44: 45: <form>46: <p>Product: <select name="product" size="1">47: <option value="Brown Jacket - Size 35 - $58.99">Brown Pants - Size 31 - $58.99</option>48: <option value="Blue Shirt - Size 32 - $69.99">Blue Shirt - Size 32 - $69.99</option>49: </select><br>50: Quantity: <input type="text" name="quantity" size="18" value="1"><br>51: <input type="submit" value="Submit" name="submit" onClick="generate_page(this.form)"><input52: type="reset" value="Reset" name="reset"></p>53: </form>54: </body>55: </html>

  9. .but the only use for something like that would be an application you're writing for yourself, not for others.
    Yes, that's exaclty what I want to do, Locally. But for all Browsers!The next best thing is ClipBoard. But I haven't yet found a way to make ClipBoard 'Browser independent'.Do you know of a way?So, I think that leaves 'Save stuff via cookies'. Which seem to be Browser independent.Am I right about that?Thanks...vmars316
  10. Far as I know, JavaScript can't write to any kind of file (except cookies). You'd need a server-side language for that.
    1) Can a server-side language run on client-side?2) If so, which ones? Browser independent?3) I guess I want to rePhrase my request:"How to write to a *.txt file, FROM a TEXTAREA and/or FROM an iFrame"? 4) Since my original request, I did find this(untested):var fso,filefso = newActiveXObject("Scripting.FileSystemObject")file=fso.CreateTextFile("C:\\a.txt")file.close(); 5) But I want to write the 'whole text' FROM a TEXTAREA and/or FROM an iFrame,NOT just one line. If I have to write a line at a time, Can TEXTAREA and iFrame be accessed by index. Thanks...vmars
  11. Greetings;How to write to a *.txt file, Browser independent.I can read it into iFrame: (not sure about TextArea though) <iframe src="vmars.txt" style="float: right; width: 260px; height: 130px; margin-left: 12px; border: 1px solid black;" name="#vmarsTXT"></iframe>but how to write it back out? Into *.txt . Not into Cookies, but a real *.txt file.Thanks...vmars

  12. I am writing a pgm to generate ComboBox dropDown Menus User enters three parms: menuname<>(1) , linkname<>(1) , linkaddress<>(1) , linkname<>(2) , linkaddress<>(2) , .... menuname<>(2) , linkname<>(1) , linkaddress<>(1) , linkname<>(2) , linkaddress<>(2) , .... I would like to create an html page with three equal columns using only <div>.I would like to create an html page with three equal columns using only <table>.I would like to create an html page with three equal columns using only <css>.I would like to create an html page with three equal columns using only <xml>.In other words, 4 separate html pages. Probably there is an example of this somewhere. BTW: Is there a place on w3schools to post user created webTools(freeware)? Thanks...vmars316

×
×
  • Create New...