SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Best Javascript book (learn combining CSS and javascript)

    Hi all,
    I would like to learn some javascript in order to understand the lines of code given below. The point is that I would like to add css into these lines of code, for example the output that is generated by value=" .("Select Column Layouts") . '">'; must be put in a span tag.

    I tried some things but I simple do not understand anything of Javascript. So can anybody give me an advice for some books that will teach me Javascript, in particular combining it with css? Any suggestion is welcome.

    1) lines of code creating the button
    return '<input type="button" class="button" onclick="document.getElementById(\'' . $this->pager_name . '_widget\').style.display=\'block\'; location.href=\'#' . $this->pager_name . '_select_columns\';" value="' . _("Select Column Layouts") . '">';

    2) how the button is presented to the user
    <input type="button" class="button" onclick="document.getElementById('CompanyPager_widget').style.display='block'; location.href='#CompanyPager_select_columns';" value="Select Column Layouts">

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Simply JavaScript, released by SitePoint just yesterday, would be the ideal book.

    The fact that I co-wrote it is merely a coincidence. ;-)
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ehm....this smells if you ask me

    Great that you replied because I was wondering if your book would do the trick. I downloaded some sample chapters but just dont have the skills to overview all what is needed to achieve my goal. So thanks for you help.

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem with your code (bear in mind I'm not a JavaScript person, hopefully Kevin can change that - which reminds me, I need to order my copy today) is that the JavaScript is inline with the HTML code. It should be in a separate file.

    Your first example looks like PHP code. Am I right about this?

    Anyway, what I'd do (if I was a scripter) is assign an ID to the input you want to use for the button, code the section of the page you want to be hidden (so that it's present by default for those with scripting turned off), then in an external JavaScript file use the DOM to reference the ID of the button as well as the portion of the page you want to hide to make the button clickable and to show/hide the part of the page you want to be dynamic.

    A List Apart has a couple articles (I think) on how to do this. I suggest you search there for examples of how you can do it.

    Hope that helps.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dan for your ideas. Thing is, those lines are out of an open source program so I have little to no information. I do think however that the first line is javascript, but since you suggest that it might be PHP I do not know it for sure anymore .

    Because I would like to know more of it and like to know how to solve some problems with javascript the book that Kevin suggested might give me the skills to understand those lines and to alter them as I like. I hope it will give me a solid base to extend my knowledge with articles on the web.

    Leaves the question, why dont you use javascript as an webdeveloper?

  6. #6
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because the books and tutorials that I found were anything but useful (I prefer writing lean, mean, unobtrusive and accessible code - something 99&#37; of the JavaScript books and tutorials omit).

    What program are you using for this?

  7. #7
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The first listing is indeed a mixture of PHP and JavaScript (and HTML, of course). You'd need a grounding in both languages to fully understand it.

    Dan is definitely right about best practice being not to put JavaScript inline with your HTML, but when you're using 3rd party code you don't always have the luxury of doing everything the right way.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  8. #8
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks both for the comments.

    @Dan, the lines of code are from a CRM programm. And since you have some experiences with JavaScript books, which books that are familiar are out of the question? Right now I have to books on my shortlist, Kevin's new book and Beginning JavaScript, 3rd edition by WROX.
    @Kevin, the reasons why you should not use JavaScript inline with HTML are also explained in your book? To be honest, although I have good experiences with Sitepoint I also tend to do some research in order to find the best book that fit my needs. Maybe you are familiar as well with Beginning JavaScript from WROX?

  9. #9
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd honestly go with Kevin's book, but only because I'm actually willing to buy it rather than wait for my local library to get a copy (six months later).

    I asked a good friend of mine (who's a programming god with nearly three decades of experience) about Kevin's new book, and despite a couple minor issues he had with it, he actually recommended I buy it based on what he saw in the PDF preview.

  10. #10
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by TManagement View Post
    @Kevin, the reasons why you should not use JavaScript inline with HTML are also explained in your book?
    They are indeed. That's the subject of the very first chapter.
    Maybe you are familiar as well with Beginning JavaScript from WROX?
    I'm afraid I'm not familiar with that book, which is probably just as well, since I could hardly give you an unbiased review.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  11. #11
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Kevin but your reply was to late I already ordered your book

    Thanks for all advice

  12. #12
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Paris
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    apress and wrox have books on the subject of very good quality!
    On a PHP/Java/XML/Javascript/MySQL internship right now!

  13. #13
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, I will be able to see so since I also ordered a book from WROX about AJAX which was having good reviews on amazon.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •