Jump to content

L8V2L

Members
  • Posts

    788
  • Joined

  • Last visited

Posts posted by L8V2L

  1. How to trigger two function in an statement; refer two both, the for statement out side the closure functions and the switch statement:

    <!DOCTYPE html><html><body><p id="demo"></p><script>var txt="ABCDEFGHIJKLMNOPQRSTUVWXYZ", str = "", i = 0, txtLength = txt.length, p = document.getElementById("demo");fo:function funcFor(){for(i, txtLength; i < txtLength; i++){p.innerHTML+=txt[i].toLowerCase();}}whil:function funcWhile(){while(i < txtLength){document.getElementById("demo").innerHTML += txt[i];i++;}}if(0<1){//whil://funcFor() /*with(*/eval(funcWhile()&&funFor());/*); funcFor();*/}/*switch(0){case 0 : {funcFor();funcWhile();//break;}case 1:{funcWhile();break;}}*/</script></body></html>

     

     

    <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><title>Demo01</title><style>#demo{color:#9f9}</style><script>var txt; //global//init function set/get data needed after onload event take placefunction init() { var button = document.getElementById("btn1");button.onclick = toggletxt;txt = document.getElementById("demo").innerHTML;}//end of init function//learnt: can have function out side of init functionfunction toggletxt(){var p = document.getElementById("demo");p.innerHTML=(p.innerHTML == txt)?("Hello JavaScript"):(txt);}//end of functionwindow.onload = init;</script></head><body><h1>My First JavaScript</h1><p>JavaScript can change the content of an HTML element:</p><!--Original problem: Could not set toggletext in element i.e: onclick="toggletext()";--><button type="button"; onclick="toggletext()";>Click Me!</button><!--Unless the actually code is set underneath the button element/node/tag--><!--<button id="btn1">Click Me!</button>--><p id="demo">This is a demonstration.</p><p>Try to give variables and functions meaningful names.</p><p>Don't try to walk the DOM without considering text and comment nodes.</p></body></html>

     

    Labelled statements are only used in conjunction with labelled break and continue statements. ECMAScript has no goto statement.reference from ECMAscript...control structure... could be call a control structure expression??? control structure statement... But as he said, control structure... a new <~~~~ technic for me.... but as stated, not usefully... but still a technique that could be use... keep in mind... control strucute.... control structure..can some one give me an example of the with statement?

  2. For now I would suggest that you don't use labels. Don't use eval. Don't use with. And don't use closures unless you can explain WHY you are using them.

    :( Could you please honor(forgot the other word... fulfill) my request. :(
  3. How to trigger two function in an statement; refer two both, the for statement out side the closure functions and the switch statement:

    <!DOCTYPE html><html><body><p id="demo"></p><script>var txt="ABCDEFGHIJKLMNOPQRSTUVWXYZ", str = "", i = 0, txtLength = txt.length, p = document.getElementById("demo");fo:function funcFor(){for(i, txtLength; i < txtLength; i++){p.innerHTML+=txt[i].toLowerCase();}}whil:function funcWhile(){while(i < txtLength){document.getElementById("demo").innerHTML += txt[i];i++;}}if(0<1){//whil://funcFor() /*with(*/eval(funcWhile()&&funFor());/*); funcFor();*/}/*switch(0){case 0 : {funcFor();funcWhile();//break;}case 1:{funcWhile();break;}}*/</script></body></html>
  4. <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><title>Demo01</title><style>#demo{color:#9f9}</style><script>var txt; //global//init function set/get data needed after onload event take placefunction init() { var button = document.getElementById("btn1");button.onclick = toggletxt;txt = document.getElementById("demo").innerHTML;}//end of init function//learnt: can have function out side of init functionfunction toggletxt(){var p = document.getElementById("demo");p.innerHTML=(p.innerHTML == txt)?("Hello JavaScript"):(txt);}//end of functionwindow.onload = init;</script></head><body><h1>My First JavaScript</h1><p>JavaScript can change the content of an HTML element:</p><!--Original problem: Could not set toggletext in element i.e: onclick="toggletext()";--><button type="button"; onclick="toggletext()";>Click Me!</button><!--Unless the actually code is set underneath the button element/node/tag--><!--<button id="btn1">Click Me!</button>--><p id="demo">This is a demonstration.</p><p>Try to give variables and functions meaningful names.</p><p>Don't try to walk the DOM without considering text and comment nodes.</p></body></html>
  5. Labelled statements are only used in conjunction with labelled break and continue statements. ECMAScript has no goto statement.reference from ECMAscript...control structure... could be call a control structure expression??? control structure statement... But as he said, control structure... a new <~~~~ technic for me.... but as stated, not usefully... but still a technique that could be use... keep in mind... control strucute.... control structure..can some one give me an example of the with statement?

  6. <!DOCTYPE html><html><head><script>function toggle0() { //I was defeated by this yester... early in the morning before I went to bed. var p = document.getElementById("demo");var txt = p.innerHTML;var button = p.previousElementSibling; button.onclick=myFunc;// <--require: JS attach event handler.function myFunc(){p.innerHTML=(p.innerHTML == txt)?("Hello JavaScript"):(txt);}}window.onload = toggle0;</script></head><body><h1>My First JavaScript</h1><p>JavaScript can change the content of an HTML element:</p><button type="button">Click Me!</button><p id="demo">This is a demonstration.</p></body></html><!DOCTYPE html><html><head><script>function toggle0() { //I was defeated by this yester... this earlier morning before I went to bed. //get id=demo, set in var p, attach event handler var p = document.getElementById("demo");var txt = p.innerHTML;var button = p.previousElementSibling; button.onclick=myFunc; //set toggle functionfunction myFunc(){p.innerHTML=(p.innerHTML == txt)?("Hello JavaScript"):(txt);}}window.onload = toggle0;</script></head><body><h1>My First JavaScript</h1><p>JavaScript can change the content of an HTML element:</p><!--can't set the attribute onclick, won't work--><button type="button" onclick="myFunc()">reconstruct the problem</button></button><p id="demo">This is a demonstration.</p></body></html>
  7. the section tag/element/node alter thee element/tag/nodes it contain. It change the size of the header tag, so it's safe to say that it alter the rest of the tag, even if you can't tell the different.

  8. You can get along quite well without ever using labels. In fact the "goto" mentality they inspire is rather questionable.

    when you say "GOTO MENTAITLIY" you are referring to label as that what they do? they reference to a object/function/variable/control structure <~~~ is this correct? Just like to have clarity. Please answer with an yes or no, following your input.

    When are you going to write some of your own code? Demonstrate some group of features? Create a simple game?

    As I study, I can see the code of what I want to do, first it was visual, now I think about what I want to happen and what I want it to look like, and it comes as code.... I need to study more, II'm in the process of going through js+json+ajax, html, js+json+ajax, css, js+json+ajax and the whole section of xml between subjection, I'll go back through js+json+ajax... and read a couple of books. Then after that, if I feel like a wizard, or less like a hack, then I'll start writing it. I'm currently finishing my second going through of js and about to head to json... or through the reference of js, might do that every other trip... but really I'm finish the third time through the tutorial of it.I', doing xml to have more of an understanding for svg.(and recently learn of smil , which is just svg animation plus more)
  9. When you typed list:{...} and populated the lines inside those curly braces with statements, not properties you basically created a "control structure" and not an "object" and then called it "list". When the interpreter came across "break list;" it told itself that it will not even look at the rest of the code inside the "list" control structure that you've created. so it instantly jumped to where the closing curly brace was and just continued from there. there is no real benefit to creating your own control structure like this. It is valid code and works like a charm... but it merely makes your code obfuscated, ambiguous, confusing. It is better to simply use functions instead as then you have more control of the scope and it is far easier to re-execute the code this way. Plus far more people will be able to follow along. It is of no use to anyone if you intentionally make obfuscated code and then ask help from others to understanding how or why it works, at worse you would only be wasting other's time. If you ever intend to work in a collaboration with other people you need to make your code easy to digest because if an event comes along that a problem arises, and you could not be contacted, AND people could not fix the problem because they could not understand your code, then you or even the entire project at hand could be canned. Don't go looking for trouble (as in coding complexly) , especially at the expense of others. Do so only if really necessary (and fully document why you did it and how). Simplicity is a virtue in programming, and the world just turns a lot better when more people can follow along. The same can be said about properly formatting your code. don't write comment on the same line as functioning code. And properly indent and space out your code. The best of us can and will forget this from time to time, but problems can be solved much sooner if people who are debugging aren't having so much trouble just reading the code. Back to the point, labels exist in javascript as an option. They have their uses as I mentioned previously. But more often than not, its better to try and avoid using them when possible as usually there are better ways of doing something without scratching people's heads.

    Thanks, I like(click like) to show my appreciation for your time. A "control structure"... I didn't create that, I copy it off the example. I've taking to mind of my comments.
  10. Hadien, Thanks for the explanations, I like(meaning I click like) it for your time spent to write it.Sorry to both you Hadien, and JSG. I know what a label is. I was more asking of how:

    cars = ["BMW", "Volvo", "Saab", "Ford"];text = "";list: {    text += cars[0] + "<br>";     text += cars[1] + "<br>";     text += cars[2] + "<br>";     break list; // I understand that it's reading through the list but still... Example./*How is it breaking out?? I could just except it, but how is it breaking it? is it cause it's in a black? So the list referring to the hold black??? How is it breaking out? It's not like a for loop or a conductions where3 the interpreter come across it and meet the condition... (in a snake like voice)What is the magic use here to make it work(snake sound) yeah, tell me.(back to me) If you still don't understand what I'm asking, that's okay, thanks for your time. I understand now why JSG was like that, it throw me off. comprehensive... I didn't relay my message clearly, or in the right wording.*/       text += cars[3] + "<br>";     text += cars[4] + "<br>";     text += cars[5] + "<br>"; }document.getElementById("demo").innerHTML = text;
  11. cars = ["BMW", "Volvo", "Saab", "Ford"];text = "";list: {    text += cars[0] + "<br>";     text += cars[1] + "<br>";     text += cars[2] + "<br>";     break list; // I understand that it's reading through the list but still... Example.    text += cars[3] + "<br>";     text += cars[4] + "<br>";     text += cars[5] + "<br>"; }document.getElementById("demo").innerHTML = text;
    function myFunction() {var text = "", i = 0;hi:    for (;i < 5;) {        text += "The number is " + i + "<br>";        (i == 3)?(break hi):(i++);// <--- it's not working.        //i++;        //if(i == 3){break hi;}    }    document.getElementById("demo").innerHTML = text;}
    Ingolme I been listen to Sonic R(races) tracks, while studying. Went through the hold play list, but mostly stick to living in the city and a diamond in the sky.
  12. Forget WebGL, it's too complicated, it requires knowledge of other, more complicated programming languages. Just focus on learning Javascript.

    The mobile version is so cool.... I'm not talking about learning it now, I just would like to talk on it. But looking at it, I'll say p.js(process) is more concise in typing, but you can define 3d object in SVG too and it's a more familiar API then both language, if only they'll speed up the animation attribute for SVG(or maybe it's just my system). I'll like your comment on this please.I'll never stop learning JavaScript, I came to far to stop, and I like(love) it. All language that I speak on is an API to be manipulated by js. I'm not going off course, I appreciate your words thought. Speaking on these APIs is speaking on js for me, cause my mind goes back to "how can I... Through js.." And only enforce me to learn it more.
  13. You may have misunderstood the definition.

    I like this post above in another word of saying you are right... do you get notify of the likes? I didn't want to have to type it out, so I just like it.

    The first case returns nothing, The second case returns an empty object.

    No... I mean, I saw that before, I saw it when it was returning... function I believe, I was trying the code example modfitying it, and I remember of it, so I through I ask. I remember it had function in it, and it was a... closure for each function I belive, and you connect the functioin as so outerfunction.colsurefunction, and as you connect to each closure in the return which wrap them in curly braces, they will return the value that closure contain, if I remember correctly... the closures was modify to be as a get and set function type with out using those keyword. I hope you understand what I'm trying to detail to you.Another discussion on web webGl, so I watch a conference video on youtube about it, and they said it was similar to c language, it rememind me of raycasting(which I try to learn, but no tutorial give a very good visual understanding and there is no book that I could find on amezon(or maybe that was just a search done on orally site...)). Any info youcan give on this. I didn't watch the hold video, just part of it, and a code that they show of each example of the effects it gave off. I want to learn it, but it make my diesre to try to make svg more than just a graphic viewer mower powerful.
  14. An element is a type of node. A node is a part of a data structure called a tree. Tags and everything between them are a text representation of an element.

    Yeah that don't help much... what I read on w3s and what you are posting to me... are different... I'm just going to go by w3c definition.
  15. <!DOCTYPE html><html><head><style>h1 {color:red;}h2 {color:blue;}p {color:green;}</style><script>function hch(){var h1 = document.getElementsByTagName("h1")[0];h1.onclick = function(){h1.style.visibility = "hidden";}}window.onload = hch; /*Was going to post for help on figuring this out, I be having trouble with the onload event handler. Until I just put the hold thing in a function. I need more understand on this though, cause it can't be that easy. What else can I do???*/</script></head><body><h1>All header 1 elements will be red</h1><h2>All header 2 elements will be blue</h2><p>All text in paragraphs will be green.</p></body></html>
  16. HTML documents are defined by HTML elements.HTML ElementsAn HTML element is everything from the start tag to the end tag:So the tags/nodes aren't the elements themselves but the contents/textNodes between the tags.nodes are the html's elements... right?

  17. the defer async properties of the script tag seem to be the ideal for having the script execute after the page have loaded instead of the onload event. The onload event is ... a little trouble to grasp I want to say.

  18. Canvas is much more versatile and more efficient than SVG. SVG is a format to save vector data, which is different than displaying an image on the screen, which is what the canvas does.You should forget about SVG because it's interfering with your learning of Javascript.

    LIKE HLL IT IS! My plan is to go through JavaScript JSON, AJAX and the reference on w3s, which I have already done... well almost done. I'm through with the DOM html object, and just going to check out two html object; canvas, script and a few other. Then I go back over html, html5, css, css3; between the section, I'm going to go through the JavaScript section again; every time I finish a section, I'm going to go through the JavaScript section again, after I'm through with that section of html and css, I'm going to go through xml section(for my understanding of SVG), between each subsection of xml I'm going to go through the JavaScript section; alone side of all of this, there is a few books I want to read, one is on webGL with no libraries(which I see as a evolve form of plugin(they never left)) involve in it.... And that's pretty much my plan. I mean it; I want to be a wizard of JavaScript, JavaScript wizard!!!JavaScript Vader: And soon, you will be. Soon.
  19. WebGL is an interface that allows a programmer to have closer access to the computer's graphics chip to perform expensive operations.

    ... I wonder why wont they have it to where svg use the cpu to speed up it's rendering? I really like it... even know I know only the basic of it. I'm planning to learn(more so become familiar with) xml; the hold section that's on w3s.; to gain more of a understanding of svg.
  20. I still think about what that person have commented... He said I was demanding... After he read all that I type, it upset him so much that he had to voice it... It.. bother me, you know...

  21. function myFunction() {    var str = "re, green";    var patt1 = /(red|green)/;    var result = str.match(patt1);// <~~ return the value twice time    document.getElementById("demo").innerHTML = result;}// <~~ return the value doable time
  22. No they aren't. You schedule a function to run at a later time and then let the CPU idle. That's pretty efficient.

    for animation purpose I'm speaking on. The window method's setInterval() and setTimeOut(), are good for...I NEED TO LEARN MORE!!!!!! For minor task and interface that want take up much power, or much cpu. Like a nice clock animation, or a cute little background animation. Or a time out animation in a for loop... while loop would better to set it to true, and have the animation run on a set time out.
×
×
  • Create New...