kodejuice
-
Posts
23 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by kodejuice
-
-
Do you mean enumerating the items in the window object, if so here is how.
for(var k in window){ console.log(k '\n'); }
-
You dont need arrays for such tasks, try this
//using jQuery $(function(){ var total = 0; $("input[type=checkbox]").click(function(){ var disVal = $(this).val(); total += Number(disVal); alert(total); }); $(".resetButton").click(function(){ total = 0; //reset }); });
-
Can someone become a web developer and a software developer, and be very good at both, I need replies please.
-
Please i need to know what every web designer must know before he/she can say "I'm a web designer", i want to know if technologies like HTTP,PhotoShop,DNS are neccessary, Please i need to know
-
Please can one briefly explain the use of this sign in javascript, and what is results to.I.e
var d = 5;return d >> 1; //=> 10
why is it '10'? -
Items returned by the prompt function are strings so you have to convert it to a number with the "Number" function.<script>function q(){ var a = Number( prompt("Enter value") ); var b = Number( prompt("Enter value") );document.getElementById("demo").innerHTML= a + b;};</script><button onclick="q()">Click on me</button><p id="demo"><p>
- 1
-
Thanks alot, please can you recommend any algorithm/data structures book for a javascript programmer.Yes, you do. Javascript is no longer just a small scripting language to make flashy effects on a website, it's pretty much a full programming language in which you can make virtually anything. Applications such as Office365 and Google Docs are made in Javascript and there are entire videogames made with it these days. If you just want to make a few effects on your websites you don't have to learn algorithms and data structures, but if you actually want a job as a Javascript programmer for any company then you really need to know these.
-
i need to know if i would learn about algorithms and data strcutures in order to be called a JavaScript programmer/* Please i'm so so confused */
-
I'm actually dealing with netscape and not IEIf you need to find a replacement for a function, it's called a polyfill. There's one for that here:https://gist.github.com/chrisjlee/8960575
-
Please how do i accomplish this, an equivalent to jquery .find function/*My Try*/function find(parent, child){ return document.querySelector(parent).querySelector(child);}<ul> <li>First</li></ul>find("ul","li"); //[object LI]//this works fine but, the support for "document.querySelector" is limited, i need and equivalent please.
-
Please how do i get around with this - I need a function that waits for like 2 seconds before moving on to the next line./*My Attempt*/function waitFor(secs){ return setTimeout(function(){ //waiting...}, (secs||1000));}alert("code started");waitFor(2000);alert("code stopped");
-
Thanks a lot, fixed my problemtoggledFunctions = {};function toggleFunc(name, fn1, fn2){ if(toggledFunctions[name]) { fn1.call(fn1); toggledFunctions[name] = false; } else { fn2.call(fn2); toggledFunctions[name] = true; }} // toggleFunc('test1', func1, func2);
-
<section id="first"> <!-- use for Ajax --> <form method="get" action="" id="add1"> <fieldset>JS Code $(document).ready(function(){ $("section#first").show(); });
-
Please i need help toggling between two functions, here is my attempt.<script> toggle = true; function toggleFunc(fn1, fn2){ if(toggle == true){ fn1.call(fn1); toggle = false; } else{ fn2.call(fn2); toggle = true; } }</script>This works perfect, but i can't have more than one "toggleFunc" function on a page.
-
Hey fuys, please i need help on how to accomplish this witout the use of Jquery .slideUp() method
-
The above code is meant to compile my code in a script tag with an id of "#val", if i read the code by line, it wont work out, cause it also read "while(!i){" as a code on its own, my question is - How do i read that particular block of code while(!i){var i = jQuery;}read this as whole and not by lineWhat's your first specific question?
-
//you dont need the put a function in the "$(document).ready". Use an anonymous function instead.<script>(function(){ //anonymous function$("#suncrlink").click(function(e){$("#suncr").load("ajax/suncr.php?m=8");});});</script>
-
//try this$(document).ready(function(e) {$("#suncr").load("suncr.php?m=8");$("#sundr").load("suncr.php?m=9");$("#cnb").load("suncr.php?m=6");$("#cstock").load("cstock.php?");});
- 1
-
//is this what u meanvar $url = "url.html";$('li').each(function(){ setTimeout(function(){ $(this).load($url);},2000);});
-
yes I Have.Have you completed the js tutorials? http://www.w3schools.com/js/default.asp
-
//check this outvar target = "TargetString";var condition = (window.location.href.toLowerCase().indexOf(target.toLowerCase()) > -1 )?"random": "no-random" ;if (condition === "random") {var request_arr = ["www.bing.com", "www.google.com","www.yahoo.com","www.sandbox.com"];var random_url = request_arr[Math.floor(Math.random() * request_arr.length)];var cook = "url="+random_url+";expires=December 25, 2060;path=/";document.cookie = cook;var url = document.cookie.split(";");for(i=0;i<url.length;i++){if(url == random_url){random_url = request_arr[Math.ceil(Math.random() * request_arr.length )];break;} else{window.location = random_url;}}} else{//target string not found in url.}
-
I have this html/javascript +jquery code, which is meant to compile my code, but i dont know how to read the javascript as a code.//the code<!DOCTYPE html><html><head><script src="jquery.js"></script><script async>window["logerrors"] = function(){var script = $("script#val").text().replace(/[n]/ig,"};");var reps = script.replace(/};/ig,"~");var eachLine = reps.split("~");var errors ="";var err = [];for($i=0;$i<eachLine.length;$i++){try{new Function(eachLine[$i])();err.push("no");continue;} catch(e){errors += "Scope Number: "+ Number($i+1) +"<br>"+e + "<br><span style='color:red;white-space: pre'>"+eachLine[$i]+"</span><hr>";err.push("yes");continue;}}if(err.indexOf("yes") > -1){$("body").html(errors);} else{return true;}}</script></head><body onLoad="logerrors()"><script id="val">var i = jQuery;while(!i){var i = jQuery;}phrompt(i.fn.jquery);ro(q);//the while loop is an example, the code reads it as "while(){"</script></body></html>
Javascript Function
in JavaScript
Posted
The first one could be called anywhere within the scope it is defined in, while the second can not.