Viewers: in countries Watching now:
This course covers the enhancements to the latest release of Adobe's web design and development software. Author James Williamson examines Dreamweaver's updated support for current Web standards, such as code hinting for HTML5, CSS3, and jQuery, and new W3C-compliant code validation. James also demonstrates the new features introduced specifically for mobile development that allow developers to download, install, and configure native applications for Android and Apple iOS. These features include support for PhoneGap integration, jQuery mobile framework, native binaries, and platform emulators launched directly in Dreamweaver.
So, var targetElement, and I need to go ahead and set this value. Now, I want to target specific elements on the page, and I want to target any element that has an ID of pageID. So to do that, I am going to type in 'document' and my code hinting comes up, and now I want to do getElementById, so I can just type in 'get' and I am going to let code hinting handle the rest of this for me. So if I hit Return or Enter, it will finish that for me, and now I need to go ahead and give it an ID. Now, what if I don't have all the IDs in my parent document memorized? Well, if I type in a quotation mark, I now get a list of all of the IDs in my parent file.
This is really cool! So I can scroll down through the list and I can find pageID, because remember, that's the one we're looking for. If I hit Return or Enter, now all I have to do is close my parentheses and type in a semicolon. All right! Now, we need to go ahead and change its color, so I'm going to go down to the next line and I'm going to type in 'targetElement.style.color = "red"'. All right, cool! So code hinting helped with that entire process, but the really cool thing there was going out to my parent page and grabbing the pageID from the code.
So I'm going to go ahead and save that, and then I want to preview this in a browser, and when I do that, I can see the element that has the pageID is now red. So let's go back in our code, and let's check out some of the other code hinting improvements that have been made. So the next thing I want to do is I want to get rid of this getElementById, and let's try getting elements by their tag name. So I'm going to type in 'document.getElementsByTagName', and now when I type in a single quote, I get an entire list of HTML elements.
This is the same list that you get when you're hand-coding in Dreamweaver in
just a normal HTML document, so they've added that as well. And now I just want
do maybe all heading 1s.
So I'm going to do h1 and hit Return and then close my parentheses.
Now, obviously we're going to get more than one of those, so I need to create
a for loop that's going to loop through them and apply the color to each one of these.
So just on top of my target element, I'm just going to go ahead and create a loop.
So I am going to do for(var i=0;
and I am going to make i
Now, I am going to ahead and place the style assignment inside my for loop. And of course I need to reference each item in the array that's returned, so I'm just going to go ahead and in bracket notation pass i in. Okay. So now let me go ahead and save this and preview this in the browser as well. And now if I scroll down, I can see that all the heading 1s on the page are now red. Perfect! Now, in addition to giving you a list of tags and giving you a list of IDs, it will also introspect all of your class names from your file as well.
So I now want to go ahead and get rid of my getElementsByTagName, and I'm going to change that to getElementsByClassName. Now, if you're wondering, it does support both the document.getElementsByClassName as well as the element.getElementsByClassName, so it will work both ways. Again, if I type in a single quotation mark, now I get all of the classes in my document. I can see that I can just scroll through all of them. And I'm just going to do accent, the first one that comes up. And now I'll close my parentheses, and we shouldn't need to change anything down here.
So I'm going to go ahead and save that, preview that in the browser, and now you can see that only where the accent class has been applied, which has been applied to this header and this header, is red. Cool! So this code hinting works for getElementById, getElementsByName, getElementsByTagName, and getElementsByClassName. What this really means more than anything else is that when you're scripting, you're going to be able to speed up the process of targeting elements on your pages, even when you're working in remote files. Dreamweaver's ability to introspect those pages and then return elements and their IDs and then classes will really just end up being one more of those little things that Dreamweaver does to help speed up your development process.
Find answers to the most frequently asked questions about Dreamweaver CS5.5 New Features .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.