DW calls Javascript method
Dreamweaver is a powerful web design tool that integrates a Javascript code editor. When writing web pages, we usually use some Javascript functions to complete some interactive operations, such as form validation, page switching, interactive effects, etc. How to let Dreamweaver call Javascript method? Let’s discuss this issue below.
1. Create a function in the built-in Javascript editor of Dreamweaver
First, we write a function in the built-in Javascript editor of Dreamweaver, for example:
function greeting() { alert("Hello World!"); }
The function of this function The function is to pop up a prompt box containing "Hello World!".
2. Embed the Javascript function into the HTML page
Next, we embed this function into a certain element in the HTML page, such as a button. You can follow the steps below:
<button onclick="greeting()">点击我</button>
The function of this button is to call the greeting function when clicked.
3. Test run
After completing the above steps, you can test the run page to verify whether the function is successfully called. You can:
If everything goes well, you should see a prompt box popping up containing "Hello World!"
4. Other calling methods
In addition to calling Javascript functions inline in HTML pages, there are other ways to implement function calls.
We can save the written function in a separate .js file, and then use the