...

View Full Version : correct my JavaScript split function please



modykurnani
12-25-2010, 11:35 PM
Whats wrong with the code below? I'm trying to get the email service provider name.


<html>
<head>

<script type="text/javascript">
function GetProvider {
var fullemail = openinviter.email_box.value;
var afterat = fullemail.split("@");
var Provider = afterat[1].split(".");
var showit = Provider[0];
openinviter.provider_box.value=showit;

}
</script>

</head>

<body>
<form action="" method="post" name="openinviter">
<input type="text" name="email_box" onchange="GetProvider()" />
<input type="text" name="provider_box" value="">
</form>





</body>
</html>

Thanks alot!

Logic Ali
12-26-2010, 12:03 AM
What's wrong with the code below?
The error console will/is trying to tell you that.

modykurnani
12-26-2010, 12:09 AM
The error console will/is trying to tell you that.

That helped. Thanks!!
incase someone ever make this mistake , adding () to the function solved it
Really stupid me lol

modykurnani
12-26-2010, 12:35 AM
Again, after adding it to my page the console is giving,



openinviter is not defined
var fullemail = openinviter.email_box.value;

any idea?
nothing changed in the code though all the ame but giving the error

thanks again

Logic Ali
12-26-2010, 12:44 AM
That helped. Thanks!!
incase someone ever make this mistake , adding () to the function solved it
Really stupid me lolNow what happens if the entry doesn't include '@' ?

rnd me
12-26-2010, 10:28 PM
Again, after adding it to my page the console is giving,



openinviter is not defined
var fullemail = openinviter.email_box.value;

any idea?
nothing changed in the code though all the ame but giving the error

thanks again

document.forms.openinviter ?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum