Jump to content
Larry Ullman's Book Forums

Paul_808

Members
  • Content Count

    25
  • Joined

  • Last visited

  • Days Won

    1

Paul_808 last won the day on September 30 2012

Paul_808 had the most liked content!

Community Reputation

1 Neutral

About Paul_808

  • Rank
    Member
  1. What you're saying all seems right to me except that the question specifically says "complete the go back link functionality so that it's accomplished in a progressively enhanced manner, similar to how the print functionality was created." I can't find the connection between the two. And the back button is created in a progressively enhanced manor having a fallback if Javascript is disabled. If this one is a tricky one for you to don't worry about it. I'm going to skip this one. I'm sure I'll have another question soon enough, Thanks!
  2. Chapter 9 #12 asks the reader to complete the go back link functionality so that it's accomplished in a progressively enhanced manner, similar to how the print functionality was created. I have spent about an hour and a half trying to figure out what this question is asking me to do. I believe the book is referencing the go back link on pg 327. Here is the code mentioned (I added return false; because what was in the book didn't work): <body> Please <a href="actualpage.html" id="backLink">go back</a> <script type="text/javascript"> document.getElementById('backLink').onclick = function(){ window.history.back(); return false; } </script> </body> The print button is added to the page only if the print functionality exists. Since the go back function works in all browsers I don't see any connection with the print functionality and the back link. Perhaps there is another way the print button is progressively enhanced? Any insight would be very much appreciated. Thanks!
  3. Awesome. Again very helpful. Thanks so much!
  4. Thanks so much Hartley. That was extremely helpful. The reason I just used the textContent property is because I am just testing this particular exercise in Firefox. This problem was just a learning exercise for me. I'm a bit confused about when and when not to use semicolons. I've probably already read this in the book but are there any rules you recommend I memorize. Thanks again!
  5. Hi, I am trying to create a page - page A, with a link that opens a popup window - page B. Page B will start with a number of 0 being displayed. On page A will be an additional link that will add 5 to the value in page B. The code I have created in an effort to accomplish this is below. The function on page B is not being called and I am not sure what I am doing wrong. Any help would be greatly appreciated. Thanks! Page A contains the following Javascript: window.onload = function(){ var link = document.getElementById('link').onclick = createPopup; } function createPopup(){ var popup = window.open('ex_new_alert.html','PopUp','height=100,width=100'); return false; document.getElementById('addLink').onclick = function(){ popup.window.addToNumber(5); return false; } }; Page B contains the following Javascript: var number = 0; var calc = document.getElementById('calc'); calc.textContent = number; function addToNumber(num){ number += num; calc.textContent = number; console.log(number); };
  6. I found another problem with this demo. If loaded in explorer or chrome many times the page loads expanded for a few seconds before the JS kicks in. I may just have to find a different solution all together.
  7. I need to create an accordion style page using Javascript for a site I'm currently working on. I found an example online that I think is going to work great for me. Unfortunately, I do think there may be a few issues with the scripts used. First there is no onload command and I think there should be. Second, I think the global namespace is going to be polluted with variables. I tried wrapping the one of the scripts in an anonymous function but that broke it. I'm not sure how to correct the issues. Any advice would be greatly appreciated. The example page is here: http://multimediadesignersite.com/test_accordion.html Thanks!
  8. Thank you very much guys. Your feedback was very helpful. The answers brought up a new question which is the difference between functions and methods. I thought they where the same. I did a bit of googleing which helped somewhat. I understand that a method is a type of function invoked from an "invocant" (generally an object or a class) but I am having a hard time visualizing what that actually means. I wonder if you could show an example of function and a method.
  9. Hello, On pg 260 #6 says to view the global variables. Is this something I can do with Firebug and if so how? When I use Firefox's default debugger it says no variables to display? Also two other questions I have are 1. What's the difference between calling and invoking a function? What's the difference between using or not using parenthesis after calling/invoking a function? 2. Why sometimes when using an element do you need to add .value and other times not? Any advice would be very much appreciated. Thanks!
  10. My array is actually named employees. I forgot to change it when I copied and pasted the code above. Sorry about that. My function is working. What I was doing wrong was trying to send an alert before the object existed in the array. I put the alert in an if statement and it works. Thanks for your advice. Again sorry about the confusion.
  11. So it looks like HartleySan is adding an object with one element to an array: newHires.push(employee.firstName); I would like to add the entire employee object including all of it's elements. I'm thinking I would do that with: newHires.push(employee); When I use alert(employees[0].firstName); it works but when I try alert(employees[1].firstName); I get nothing. Any suggestions?
  12. I'm a bit confused with exactly what this question is asking me to do. I'm looking at the solution above and it does not quite make sense to me. In the code above a new object is created named var employee. This appears to be the only object created. Don't I need to create several objects in order to create an array out of them? Can someone please explain what I am missing. Thanks!
  13. It seems after much agony I have finally got my scripts to work in Explorer. Just changing the encoding under the encoding drop down and saving the file was not enough. I needed to change the default encoding settings (under settings>preferences>new document) to UTF8 without BOM. I tried a bunch of things but I think this was the solution.
×
×
  • Create New...