Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to call a function

Status
Not open for further replies.

geethanandh

Programmer
Jun 5, 2002
21
0
0
US
hi
i know this questions sounds silly, how do i call a javascript function inside the HTML just like that. There is no event handler to invoke that.
<html>
<script>
function test() { alert(&quot;hi&quot;); }
</script>
<body>
---
here i have to call the function test
----
</body>
</html>

bye
geethanandh
 
if you just want the function to run auto then take out the word function and the script will run when the page is loaded
<html>
<script>
{ alert(&quot;hi&quot;); }
</script>
<body>
</body>
</html>
You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
You could also call the name of your function later down in the page.

Code:
<body>
<script>
test()
</script>
</body>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top