It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Calling functions with button

Calling functions with button

Postby ElDudereno on Tue Aug 04, 2009 11:14 am

The code below is suppossed to take an input in a textbox and upon the click of a button call a function to check the input.
I cannot get this to work at all the text box and button appear but the code for the function appears on the page and the button press does nothing.
Any advice here please :confused:

// Creates text box for bank sort code to be entered
<p>The layout used in this input is three pairs of numbers seperated by -. Thanks for taking the time to read this!</p>

<input type="text" name="Bank_Sort_Code" maxlength="8" />



<p><input type="button" value="Click here" onClick="validateBankNo();"></p>


<script language="javascript" type="text/javascript">
function validateBankNo()
{
if(ereg('^[0-9]{2}-[0-9]{2}-[0-9]{2}$', $Bank_Sort_Code))
return True;
else
return false;

}
</script>
ElDudereno
 
Posts: 1
Joined: Tue Aug 04, 2009 10:57 am

Re: Calling functions with button

Postby hellsmissingdevil on Wed Aug 05, 2009 8:27 am

hey

ereg function doesnt work with javascript

here u can try (yourstring).replace function in javascript.

u can get the syntax for replace function on google
hellsmissingdevil
 
Posts: 6
Joined: Fri Jul 10, 2009 9:40 am


Who is online

Users browsing this forum: No registered users and 2 guests