You can run the code live in Dreamweaver by pressing the Live button. The way you are asking this question, it seems like you are still editing the code. You need to switch it over to Live to see it in action. Whilst Dreamweaver can give you an insight to how certain aspects of the code works, it is not recommended to do this ALL the time. You need to check the work in progress through an actual browser, to determine what works and what doesn’t.
I suggest you read the documentation and tutorials for Dreamweaver, because while it is a very useful tool to have, you need to know how to use it correctly.
solved Javascript not firing in dreamweaver