File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed
spring-web-modules/spring-thymeleaf/src/main/webapp/WEB-INF Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44< meta charset ="UTF-8 " />
55< title > Thymeleaf: Javascript function call</ title >
66</ head >
7- < script type ="text/javascript "
8- src ="../js/functionCall.js ">
7+ < script th:inline ="javascript ">
8+ function greetWorld ( ) {
9+ alert ( "hello world" )
10+ }
11+
12+ function salute ( name ) {
13+ alert ( "hello: " + name )
14+ }
915</ script >
16+
1017< body >
1118 < header >
1219 < div > Thymeleaf: Javascript function call </ div >
1320 </ header >
1421 < main >
1522 < section class ="flex-box ">
1623 < button th:onclick ="greetWorld() "> using no variable</ button >
17- < button th:onclick ="'alert(\' 1. static variable used here.\');' "> using static variable</ button >
18- < button th:onclick ="'alert(\' '1. There are exactly + ${totalStudents} + students' \');' "> using inline dynamic variable</ button >
19- < button th:onclick ="'javascript:alert(\''2. There are exactly + ${totalStudents} + students' \');' "> using javascript:function</ button >
24+ < button th:onclick ="'alert(\'static variable used here.\');' "> using static variable</ button >
25+ < button th:onclick ="'alert(\'There are exactly ' + ${totalStudents} + ' students \');' "> using inline dynamic variable</ button >
26+ < button th:onclick ="'javascript:alert(\'There are exactly ' + ${totalStudents} + ' students \');' "> using javascript:function</ button >
2027 < button th:data-name ="${student.name} " th:onclick ="salute(this.getAttribute('data-name')) "> using data attribute</ button >
21- < button th:onclick ="@{'salute(' + ${student.name} + ');'} "> using @ tag</ button >
2228 < button th:onclick ="salute([[${student.name}]]) "> using double brackets</ button >
2329 </ section >
2430 </ main >
You can’t perform that action at this time.
0 commit comments