Jump to content

vmars316

Members
  • Posts

    480
  • Joined

  • Last visited

Posts posted by vmars316

  1. for starters, look at your curly brackets

    Also, check out the the if tutorial:

    Do you mean continue instead of start?

    Thanks,

     

    Ok, fixed the curly brackets .

    I can't see the if error.

    I think I mean continue, so flow will go up to start.

    But still no go.

     

    <script type="text/javascript">
    function myFunction() {
    var i = 0;
    start: while (i < 3) {
    alert("alert box #1");
    alert("alert box #2");
    i++;
    if (i < 3) continue start;
    break;
    }
    }
    </script>
    Thanks..vm
  2. Hello & Thanks;

    The following doesn't work, pls, how come ?

    <script type="text/javascript">
    function myFunction() {
    var i = 0;
    start: while(i < 3) {
    alert("alert box #1");
    alert("alert box #2");
    i++;
    if(i < 3) continue start;
    break;
    }
    </script>
    Thanks..vm
  3. Thanks Folks, here is the current code : <style type="text/css">.catg {style="border: 1px; border-style:solid; border-color:#BB96A8; background-color:#CCC2B6; color:#FFFFFF; font-size: 12pt; font-weight:bold;"} .desc {style="border: 1px; border-style:solid; border-color:#BB96A8; background-color:#CCC2B6; color:#FFFFFF; font-size: 14pt; font-weight: bold;"} a:link{color: #FFFFFF;} a:hover {color: #FFFFFF;} a:active{color: #FFFFFF;} a:visited{color: #FFFFFF;}</style> <table><!-- style="color:#F1E9DC;">[~Most-Used] --><tr><td class="catg">[~Most-Used]</td><td class="desc"><a href="http://alternativeto.net/">AlternativeTo Software</a></td></tr> <tr><td class="catg">[~Most-Used]</td><td class="desc"><a href="http://www.quickerthanaspark.com/BenghaziGame/BenghaziGame.html">Benghazi Game Intro</a></td></tr></td></tr> <tr><td class="catg">[~Most-Used]</td><td class="desc"><a href="http://www.hotmail.com/?">hotmail.com</a></td></tr> <tr><td class="catg">[~Most-Used]</td><td class="desc"><a href="http://jsdo.it/vmars316/8D5g/edit">jsdo.it javascript</a></td></tr> <tr><td class="catg">[~Most-Used]</td><td class="desc"><a href="http://www.portablefreeware.com/?">portablefreeware.com/</a></td></tr>

  4. newseed,I couldn't get the following to work.

    [/size]<style type="text/css">div#mylinks {background-color: blue;}div#mylinks a {background-color: lightgreen;}</style></head>...............<div class="mylinks">..............</div class="mylinks"> 

    Above, what am I doing wrong ?The following works but is painfully verbose:

    [/size]<br><span style="color:#E7A97E; font-weight:bold; background-color:#726B50">[~Most-Used] </span><a href="http://www.quickerthanaspark.com/BenghaziGame/BenghaziGame.html"><span style="color:#FFFFFF; background-color:#645E46  ">Benghazi Game Intro</span></a> <br><span style="color:#E7A97E; font-weight:bold; background-color:#726B50">[Arduino] </span><a href="http://www.manning-sandbox.com/forum.jspa?forumID=788&start=0"><span style="color:#FFFFFF; background-color:#645E46  ">~Arduino in Action Forum</span></a> 

    Pls note, that the textColors and background-color are diff for Category([~Most-Used] and [Arduino]) and aLinks. Thanks

  5. I have a page of 100 links, that looks like this:<br>[~Most-Used]<a href="www.hotmail.com/?">hotmail.com</a><br>[~Most-Used]<a href="http://alternativeto.net/">AlternativeToSoftwares</a><br>[~Most-Used]<a href="http://jsdo.it/vmars316/asdf/edit">jsdo.it javascript</a><br>[~Most-Used]<a href="http://www.portablefreeware.com/?">portablefreeware.com/</a><br>[Arduino]<a href="http://arduino.cc/forum/index.php#2">~arduino.cc/forum</a><br>[Arduino]<a href="http://arduino.cc/playground/">~arduino.cc/playground</a> And I want to color text and text-background different colors: [~Most-Used] text = black, text-background = blue >hotmail.com</a> text = red, text-background = lightGreen I suppose <span> would work. Or could i use "<br>[" and '">' as style tags ? Is there a better way than span ? Thanks

  6. Hello & Thanks ,I created a javascript webBrowser Game that uses the following .html :

    <!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, user-scalable=no"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><title>Benghazi Game: Lies  and  Cow Pies </title><style type="text/css">body{margin:0;}</style><!-- <script src='http://web-research.appspot.com/files/enchant/enchant.min.js'></script> --><script src="enchant.js"></script><script src="BenghaziGame.js"></script> </head><body></body></html>

    But now I would like to put the code into an iFrame so that I can add 'game directions text' to the webPage .Pls, what code would I need to do this ? Thanks...Vernon

  7. There's the reload() method of the location object http://www.w3schools..._loc_reload.asp
    Thanks fm ,I see this :< assign() Loads a new document reload() Reloads the current document replace() Replaces the current document with a new one > Is there a way to Stop or Abort javascript , not only current Function , but stop all javascript processing... I notice that here : http://jsdo.it/B12AE002/m83kThey do a PLAY , STOP , and a RELOAD .Thanks..
  8. The |= operator assigns the logical OR operation between the left and right operands to the left variable. if lieCheck is 0 then 0 | 1 is 1 which is equivalent to a boolean True. Anything operated with 1 will return a truth value because the 1 will always ensure that the last bit is set to 1. Maybe you wanted to use the & operator instead.
    Thanks..vm
  9. Hello & Thanks , I am trying to manually trace (alert !) when things get executed .The first thing i notice is that

    Hello World !

    Then (Enter a number)

    	number = prompt("Enter a number:", "5") 	document.write(Factorial(number));

    Gets executed next .?? Does that means that 'everything js' outside of the Function gets executed first ???? sort of an initialization of the js code 1st?? Then:

    var r=confirm("CONFIRM: aNumber = "+aNumber+"   " +"OK, keep going , or CANCEL ");

    Gets executed TWICE , no matter what I click on OK or CANCEL . Also , here:

    		alert("aNumber is less than Zero !") 		return "undefined";

    return "undefined";

    gets executedButalert("aNumber is less than Zero !") does not .Pls , can someone show me what the proper code should be ?Also , how can I get each .innerHTML and document.write on a separate line , rather than write on a new page ? I would like to see all Trace stuff on the same page . Thanks...vm

    <!DOCTYPE html><html>  <head>	<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">	<title></title>	<meta content="vmars316" name="author">  </head>  <body onload="Factorial(4)">  <h3>Hello World !</h3>  <p id="demo"> </p>  <script>  var TimesIn =0;  function Factorial(aNumber){	{	var x;	var r=confirm("CONFIRM: aNumber = "+aNumber+"   " +"OK, keep going , or CANCEL ");	if (r==true)	  {	  x=(".innerHTML: x =  "+"aNumber = "  +aNumber+"   " +"OK , keep on going!") ;	  document.getElementById("demo").innerHTML=x;	  }	else	  {	  x="x = "+aNumber+"   Cancel , it is !";	  document.getElementById("demo").innerHTML=x;	  return;  // Exit Function	  }	  document.getElementById("demo").innerHTML=x;	}// If the number is not an integer, round it down.	aNumber = Math.floor(aNumber);	TimesIn = TimesIn + TimesIn + 1;	document.write("TimesIn = " + TimesIn) ;	 alert()// The number must be equal to or bigger than zero	if (aNumber < 0)	{		alert("aNumber is less than Zero !")		return "undefined";	}	if ((aNumber == 0) || (aNumber == 1))	{ // If the number is 0 or 1, its Factorial is 1.		alert("aNumber is 0 or 1, its Factorial is 1 !")		return 1;	}	else	{ // Make a recursive call		alert("aNumber * Factorial(aNumber - 1")		return (aNumber * Factorial(aNumber - 1));	}} // End of Factorial	number = prompt("Enter a number:", "5")	document.write(Factorial(number));  </script>	<p><br>	</p>  </body></html>

  10. Ah yes , I am not a great fan of "can't get there from here" kind of thinking .I did manage to find some javscript-code-to-flowchart .Here are a few so far : * code to flowchart : http://www.fatesoft.com/s2f/ http://www.aivosto.com/visustin.html http://www.cadkas.de/downengtools10.php $79 http://download.cnet.com/1770-20_4-0.html?query=AthTek+Code+to+FlowChart&tag=srch&searchtype=downloads&filterName=&filter= javscript-code-to-flowchart would be a help to me in learning to code javascript ,especially , to study *.js coded by others . ...vm

  11. There may be some confusion regarding Javascript's object/array syntax. You can store your key name in a variable like this: var myKey = "myDiary_"+TodaysDate; But doing this will not work: localStorage.myKey That will look for the key "myKey", not the value of that variable. Either of these will work correctly though: localStorage[myKey]localStorage.getItem(myKey)
    THanksSomething is wrong with my onClick , or maybe my Functions_structure , I get no Alert . <!DOCTYPE html><!--__0.localstorage__0.localstorage-journal--><html><title>~~~localStorage-03.html</title> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <title></title> <script type="text/javascript"> window.onload = function init () { var TodaysDate = "01/29/13" var myKey = "myDiary_"+TodaysDate; alert("Hello , Today's Date is " + TodaysDate); } </script> <script type="text/javascript"> // localStorage.test = JSON.stringify(obj); // localStorage.setItem('myKey', 'myData'); function GetTodaysPage () { document.getElementById("GetTodaysPage").onclick = function () { alert("Hello , from GetTodaysPage " + TodaysDate); TodaysPage = localStorage.getItem[myKey]; } <!--End of function GetTodaysPage--> function SaveTodaysPage () { document.getElementById("SaveTodaysPage").onclick = function () { alert("Hello , from SaveTodaysPage " + TodaysDate); localStorage.setItem[[myKey] , TodaysPage]; } </script> <!--End of function SaveTodaysPage--> </head> <body> <div> <input type="button" value="GetToday'sPage" id="GetTodaysPage"> <input type="button" value="SaveToday'sPage" id="SaveTodaysPage"> </div> <div> <textarea id="TodaysPage" cols="80" rows="80"> </textarea> </div> </body></html> Thanks..vm
  12. 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

×
×
  • Create New...