Jump to content

SnakesBite101

Members
  • Posts

    81
  • Joined

  • Last visited

Posts posted by SnakesBite101

  1. I understand how Ternary operators work but i came across an inline one and im trying hard to figure out what each operation is doing. Can anyone please explain this to me: var hadRelations = false,isSure = false, presidentQuote = hadRelations ? "Did not have relations" : isSure ? "Did not have relations" : "I admit"; "I admit" is the value returned 1st i dont understand why they use "," instead of ";" to terminate variable definitions. But what is the Ternary doing? i don't understand the use of the first two strings in the operation. What is the concept here, what would make the return value equal to either of the first two strings, instead of the last one? Thanks

  2. I tried it in FF13, Chrome20, and IE8 and thought they all looked very similar. All the buttons were rather large. Also when you scrunch the width of the page things start overlapping, which doesn't look good.
    can i stop that happening by using max-height, max-width etc..? i used position relative or absolute. is fixed a better choice?ill definately not use those types of buttons again. just checking to see what i could do. ill start a new page and try and make it look a lot more readable and well thought out. thanks
  3. PHP is much more important than Javascript. Both PHP and Javascript are programming languages and therefore much more complex than HTML or CSS.
    in your opinion could u please tell me which 1 is better to learn 1st. php or Javascript? also is learning HTML5 a lot harder to learn than 4?
  4. hey guys. W3schools has taught me everything i know. after HTML, they advised CSS, then Javascript. Even though i find JS hard, i believe i have past the beginner level, but still Im just not satisfied with my skill with JS yet. i have stalled. i don't believe im progressing anymore. w3schools advised PHP after JS. An old friend of mine said Javascript is better learned AFTER or with PHP but not by itself. He's reasoning is i need server stuff to work with. That if i learn JS alone, there are certain aspects of JS I won't be able to put into practise, it will just be memory knowledge i.e AJAX... that will eventually become impossible to progress. but if i learnt PHP, i will now be able to learn things like ajax and jQuery and put my knowledge of them into practical use, and not just remember what i read. I never thought learning php before JS was an option, or even together. My progress has stalled so i wonder if what he's saying is true, or is it too much to learn all of these things mentioned together?

  5. Hey guys, i need a little help understanding cookies. I feel the cookie tutorial on the site was rather poorly explained. i'm trying really hard to make sense of it, i'm sure it's a small detail im missing. http://www.w3schools.../js_cookies.asp it starts off with this code: function setCookie(c_name,value,exdays){var exdate=new Date();exdate.setDate(exdate.getDate() + exdays);var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());document.cookie=c_name + "=" + c_value;} Most of this is clear, but can someone tell me what a cookie value is? They explained c_name as a visitors name. exdays as days until cookie expires. But c_value was never explained. niether was the ternary operator in the whole tutorial. i understand the operator but not in this context. what is escape(value)? this part is what really confuses me: function getCookie(c_name){var i,x,y,ARRcookies=document.cookie.split(";");for (i=0;i<ARRcookies.length;i++){x=ARRcookies.substr(0,ARRcookies.indexOf("="));y=ARRcookies.substr(ARRcookies.indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if (x==c_name){return unescape(y);}}} what is var i,x,y,ARRcookies=document.cookie.split(";");? and what object or string exactly is being split? Im guessing its the data from the previous function etc.. but the splitting and slicing of an array is very confusing as the actual string being split was never shown, so i have no idea what is being done. then i guess those are regular expressions at the end? its just so confusing. that whole code including the parts i didnt paste, was only explained with 9-10 lines. if you might not be able to explain this, could you please direct me to any sites that explains the coding of cookies in greater detail? Thanks all

  6. you can add a sticky footer which will push the content footer down and the content would go along with the footer, i can help you out a little with the sticky footer if you wish "explainning it well thats something im not good at hehehehehehe"
    hey sorry i didnt see your last message. sure i would love some help to fix that issue. i havent even touched or modified the site since then as ive been just studying Javascript. With the bad design of the site, i probably won't touch it again, but it would be nice to know hot to fix the issue
  7. i have a question. i did a quick person array. ive used both a for and for in loop to loop through it. they give me the same results. If i alert the results, i get a separate alert for each element in my array. but if i use document.wrtie, my code only writes out the 1st element, "john". can anyone tell me why this is happening: <!DOCTYPE html><html><body><button onclick="myFunction()">Try it</button><script type="text/javascript">function myFunction(){var x;var person=["John","Pete","Ray"];for (x in person){document.write(person[x]);//alert works fine but not document.write}}</script></body></html>

  8. my suggestions are:
    1. horizal buttons are way too big, i suggest making them a little smaller
    2. page is too dark and bluee, i would suggest a light blue like baby blue, etc or a lighter color
    3. that thing on the upper left corner, its kinda a bad picture to place there, i can see its kinda losing its pixels
    4. the vertical buttons on the right, can also be smaller, well i think all your buttons can be smaller and the removal of the white & blue border around them.
    5. the "User Features" title or tab on the right, can be align with the profile picture
    6. and last but not least, i think you need a sticky footer, because the youtube video passed the ending of the content and i can see the yellow line, which to me states that, thats where the content div ends ( if im wrong, my bad ).

    anyway thats my suggestions, if you wish i can do it again after you make your changes well later

    thanks guys. hey on 6) you are right. in my 1st post i said that the video is whats making me not complete the site. which is why i put the yellow border, bottom of the page container to show how that video went outside of it. the containers height is 100% so i dont know why this happened. margin and padding doesnt fix it. thank you for your points i will make all changes. very tough to spend time on the page because im trying to learn javascript, HTML5 and CSS3 at the same time:(
  9. let me try to explain: function sumValues(val1, val2, val3) {if (val1 === undefined) {val1 = 0;} if (val2 === undefined) {val2 = 0;} if (val3 === undefined) {val3 = 0;}return val1 + val2 + val3;} the function is expecting 3 values(numbers) to be passed in for addition. like this, var addnums = sumValues(3, 5, 6) .. the IF statement means if a number is left out. like if i only pass val 1 and 2 but not 3. var addnums = sumValues(3, 5) <--- if val3 === undefined {value3 = 0}. they want me to use the default operator instead of the IF statement to set the value of any arguments that are left undefined to 0.

  10. im not sure. how the function would work wasnt clear. the whole code wasnt written. it was a task in a tutorial. the aim of what i was instructed to do is to learn to replace if statements with either ternary or default operators. they gave 1 example, then set this task. here's the example: if (min === undefined) {min = 1;}// becomes simplymin = min || 1; var contactInfo;if (email) {contactInfo = email;} else if (phone) {contactInfo = phone;} else if (streetAddress) {contactInfo = streetAddress;}// is greatly shortened tovar contactInfo = email || phone || streetAddress;

  11. hey guys can someone please tell me what this attribute means or does? <textarea wrap="virtual"> also what does the length property actually do in an input field? if i have length="2" i can still type more than 2 characters. and i believe the rows="8" is actually what defines the actual length of an input field?

  12. looks simple but i cant get it: // this function uses the if blocks to // handle the optional parameters. // Change it to use the default operator instead. function sumValues(val1, val2, val3) { if (val1 === undefined) { val1 = 0; } if (val2 === undefined) { val2 = 0; } if (val3 === undefined) { val3 = 0; } return val1 + val2 + val3;}

×
×
  • Create New...