html - How to switch between JavaScript? -



html - How to switch between JavaScript? -

i have html website has basic html structure.

<!doctype html> <html> <meta charset="utf-8"> <head> <title>cool site bro</title> </head> <body> <script type="text/javascript"> . . . script contents . . . draw elements pages, functions, etc. </script> </body> </html>

which uses javascript draw elements on page create simple graph.

with divs or other html objects know can take advantage of css property display , utilize javascript or jquery alter display block none or vice versa. there similar script tags hide contents of 1 , show another, sense page refresh , javascript required.

what best way switch between 2 scripts on event clicking button?

you don't need hide whole <script> tag. need create part of code inactive. way achive set part of javascript code within function.

then, can phone call 1 function, or another. so, best way switch between 2 scripts on event clicking button be:

<button onclick="function1()" ondblclick="function2()"></button>

javascript html

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -