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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript function

Status
Not open for further replies.

heals1ic

Programmer
Apr 25, 2006
15
AU
For the life of me I cannot seem to sort out what I am doing wrong here.

My firefox error console reports that signup is not a function :

The script is in the header.

Code:
<script language="JavaScript"> 
function signup(){
	alert("Hello");
};
</script>
                    <form name="signup">
                    <table class="signuptbl" cellSpacing=0 cellPadding=0 border=0>
                        <tr>
                            <td align="right">
                                <label for="email">E-mail&nbsp;:&nbsp;</label>
                            </td>
                            <td align="left">
                                <input class="prof" type="text" name="email" size="35" maxlength="80" value="">  *
                            </td>
                            <td align="center" colspan="2">
                                <input type="button" name="subsignup" value="SUBMIT" onclick="signup();">
                            </td>
                        </tr>
                    </table>
                    </form>

I know it is probably something simple but I have spent quite a bit of time stripping the code back to its barest to diagnose but still I cannot get this to work.
 
Change your form name to something other than signup and it should work. I'm no pro at Javascript, but I think its because you're declaring both the form name and your function name with the same "signup" declaration. I took your code, changed the form name, and it worked for me (I got a hello). Good luck.
 
Thanks

I changed the function name to signupnow() and it seems to work.

I have never come accross this issue before though?
 
Could be one of the issues to the latest builds to the web browsers. I know they're doing a lot of changes that affect web developers (IE7 for example has several builds and each one seems to change some rule that affects HTML/Javascript coding). I wish I could tell you for sure what was going on though. Take care.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top