Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-25-2010, 11:35 PM   PM User | #1
modykurnani
New to the CF scene

 
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
modykurnani is an unknown quantity at this point
Unhappy correct my JavaScript split function please

Whats wrong with the code below? I'm trying to get the email service provider name.

Code:
<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!
modykurnani is offline   Reply With Quote
Old 12-26-2010, 12:03 AM   PM User | #2
Logic Ali
Regular Coder

 
Logic Ali's Avatar
 
Join Date: Sep 2010
Location: London
Posts: 961
Thanks: 0
Thanked 198 Times in 193 Posts
Logic Ali will become famous soon enoughLogic Ali will become famous soon enough
Quote:
Originally Posted by modykurnani View Post
What's wrong with the code below?
The error console will/is trying to tell you that.
Logic Ali is online now   Reply With Quote
Old 12-26-2010, 12:09 AM   PM User | #3
modykurnani
New to the CF scene

 
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
modykurnani is an unknown quantity at this point
Thumbs up

Quote:
Originally Posted by Logic Ali View Post
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 is offline   Reply With Quote
Old 12-26-2010, 12:35 AM   PM User | #4
modykurnani
New to the CF scene

 
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
modykurnani is an unknown quantity at this point
Again, after adding it to my page the console is giving,

Code:
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
modykurnani is offline   Reply With Quote
Old 12-26-2010, 12:44 AM   PM User | #5
Logic Ali
Regular Coder

 
Logic Ali's Avatar
 
Join Date: Sep 2010
Location: London
Posts: 961
Thanks: 0
Thanked 198 Times in 193 Posts
Logic Ali will become famous soon enoughLogic Ali will become famous soon enough
Quote:
Originally Posted by modykurnani View Post
That helped. Thanks!!
incase someone ever make this mistake , adding () to the function solved it
Really stupid me lol
Now what happens if the entry doesn't include '@' ?
Logic Ali is online now   Reply With Quote
Old 12-26-2010, 10:28 PM   PM User | #6
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,462
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by modykurnani View Post
Again, after adding it to my page the console is giving,

Code:
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 ?
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Tags
split function

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:47 AM.


Advertisement
Log in to turn off these ads.