NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Tell a friend script

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 04-06-2006, 10:27 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
asgsoft's Avatar
Join Date: Sep 2005
Location: At Home
Posts: 881
asgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of light
 



Tell a friend script


OK, I have this so far:
Code:
<script type='text/javascript'>
function showField(div_name)
{
 var txt = "";
 var num = document.form1.item_count.value;
 for(i = 0; i < num; i++)
 {
   txt += "<input type='text' name='friendname_" + i + "' value='name' onfocus='this.value='''/></input><input type='text' name='friendemail_" + i + "' value='email'/><br /></input>";
 }
 document.getElementById(div_name).innerHTML = txt;
}

function showDropDown()
{
 if(document.form1.checkbox_name.checked == true)
 {
   document.getElementById('dropdown').style.display = "block";
 }
 else
 {
  document.getElementById('dropdown').style.display = "none";
  document.getElementById('email_div').innerHTML = null;
 }
}
</script>
How can I make the textboxes empty when you click on them?
????: NamePros.com http://www.namepros.com/programming/184422-tell-a-friend-script.html

s there a way of resetting the value of the drop down menue when it is hidden?

Also why doesn't it show the textbox tag in the html of the file when it is showing them?

Have a look at this site to see it in action: http://asgsoft.net/petition/tellafriend.php?id=1

PLEASE TICK THE BOX TO START.

Thanks for the help in advance
asgsoft is offline  
Old 04-06-2006, 12:53 PM   #2 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 608
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
>>How can I make the textboxes empty when you click on them?

add this inside the input tags: onclick="this.value='';"

>>Is there a way of resetting the value of the drop down menue when it is hidden?

find this line: dcument.getElementById('dropdown').style.display = "none";
add after: dcument.getElementById('dropdown').value= "";

>>Also why doesn't it show the textbox tag in the html of the file when it is showing them?

Because the code isn't a part of the html file. It's generated by the javascript seperately.
__________________
ask me about the internet
Jim_ is offline  
Old 04-06-2006, 01:05 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
asgsoft's Avatar
Join Date: Sep 2005
Location: At Home
Posts: 881
asgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of light
 



Originally Posted by Jim_
>>How can I make the textboxes empty when you click on them?

add this inside the input tags: onclick="this.value='';"
This is part of a variable and so it will not work
????: NamePros.com http://www.namepros.com/showthread.php?t=184422

Originally Posted by Jim_
>>Also why doesn't it show the textbox tag in the html of the file when it is showing them?

Because the code isn't a part of the html file. It's generated by the javascript seperately.
Is there a way to make it part of the document because i need to be able to send their values via php
asgsoft is offline  
Old 04-06-2006, 01:16 PM   #4 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 608
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
txt += "<input type='text' name='friendname_" + i + "' value='name' onfocus=\"this.value='';\" /></input><input type='text' name='friendemail_" + i + "' value='email' onfocus=\"this.value='';\" /><br /></input>";

That should work.

As long as the div that you're printing the tags into is enclosed in <form> tags, it should be able to post to a php page just fine.
__________________
ask me about the internet
Jim_ is offline  
Old 04-06-2006, 02:02 PM THREAD STARTER               #5 (permalink)
NamePros Regular
 
asgsoft's Avatar
Join Date: Sep 2005
Location: At Home
Posts: 881
asgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of light
 



your the man. It works, I don't know how to thank you

how can i validate email address?
asgsoft is offline  
Old 04-07-2006, 12:46 AM THREAD STARTER               #6 (permalink)
NamePros Regular
 
asgsoft's Avatar
Join Date: Sep 2005
Location: At Home
Posts: 881
asgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of light
 



here is my email validation script:
????: NamePros.com http://www.namepros.com/showthread.php?t=184422

Code:
<script language = "Javascript">

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}
asgsoft is offline  
Old 04-07-2006, 03:39 AM   #7 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 608
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
add this function along with that email validation function:
Code:
function checkall() {
  var check = true;
  var num = document.form1.item_count.value;
  for(i = 0; i < num; i++) {
     eval("check = echeck(friendemail_' + i + ');");
     if(check==false) return false;
  }
  return true;
}
then add onsubmit="checkall();" to the <form> tag.

Should work. Haven't tested it.
__________________
ask me about the internet
Jim_ is offline  
Old 04-07-2006, 03:49 AM THREAD STARTER               #8 (permalink)
NamePros Regular
 
asgsoft's Avatar
Join Date: Sep 2005
Location: At Home
Posts: 881
asgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of light
 



it doesn't seem to work.

Look at http://asgsoft.net/petition/tellafriend.php?id=2 to see it in action
asgsoft is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:11 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger