Search the Community
Showing results for tags 'value'.
-
The following code is from chapter 5 of this book. if (!comments || !comments.value || (comments.value.indexOf('<') != -1) ){ okay = false; alert ('Please enter your comments, without any HTML!'); My question is why do we have to both put !comments and also !comments.value. Aren't they the same?? Why check comments if it doesn't have a value. I just learned php with Larry's book, and am new at javascript.
-
Hi, Here are two quotes from Creating Cookie Library example: Would not it be better if instead of "cookie values" we use just "cookies" (... some browsers add a space in between the cookies in document.cookie. ) and "Decode the cookie" instead of "Decode the value"? Is it correct to say that "some browsers add a space in between the cookies in document.cookie" INSTEAD OF "some browsers add a space in between the cookie values in document.cookie" ??? Thank you in advance!
-
Hi, I have one question about this. In the book it is written that "Doing the above would call the init() function and assign the value returned by it to the window.onload property, which is not the intent." Let's say that somewhere in JavaScript exsist the following code: var init = function() { //some code return something; } Here, a function definition is a value assigned to a variable. Now, we have: window.onload = init; and that code assigns to the onload property of the window object the value of the init variable. OK. Let's suppose that there exists the following function which does the same function init() { //some code return something; } In this case, it would be the same to use: window.onload = init; AND window.onload = init(); But in reality, this is not the case, there is no init() function, there is only init variable so it isn't the same. Am I right?