0

Hello,
I have small problem and can't solve it. I am trying to write javascript function inside html file and call it from click button but it does not work. I try both tags:
<script type="text/javascript">
<script language="JavaScript">
I include it at the head tag, at first of body, at end of body, before head. but, does not works!
it called from <input type='button' name='but' onclick="alertx();">
and it just alerting

<script type="text/javascript">
function alertx()
{alert('hi');}
</script>

Any help please.
Thanks,

2
Contributors
5
Replies
19
Views
1 Year
Discussion Span
Last Post by diafol
0
<html>

<script type="text/javascript">
function alertx()
{alert('hi'); }
</script>

<head>
<script type="text/javascript">
function alertx()
{alert('hi');}
</script>
</head>

    <body>
        <script type="text/javascript">
            function alertx()
            {alert('hi');}
        </script>
        ..... some inputs ......
        <input type='button' name="x" value='Basic search'  onclick="alertx()">
        ..... some inputs ......
        </body>
        </html>
0
<html>

<head>
<script type="text/javascript">
function alertx()
{alert('hi');}
</script>
</head>
    <body>

        ..... some inputs ......
        <input type='button' name="x" value='Basic search'  onclick="alertx()">
        ..... some inputs ......
        </body>
        </html>

Works for me. You sure js has not been disabled on your Browser?

0

It does not work for me. but, when I alert here:

<input type='button' name="x" value='Basic search'  onclick="alert('hi');">

it working.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.