[advanced search]
Results from the most recent live auction are here.
22 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Domain Name Industry Newsletter
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 04-06-2006, 11:27 AM   · #1
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 821
NP$: 990.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
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?

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


Please register or log-in into NamePros to hide ads
asgsoft is offline   Reply With Quote
Old 04-06-2006, 01:53 PM   · #2
Jim_
NamePros Regular
 
Jim_'s Avatar
 
Name: Jim, of course
Location: Philadelphia
Trader Rating: (20)
Join Date: Aug 2005
Posts: 558
NP$: 14.30 (Donate)
Jim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of light
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.
__________________
woop woop
Jim_ is offline   Reply With Quote
Old 04-06-2006, 02:05 PM   · #3
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 821
NP$: 990.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
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

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   Reply With Quote
Old 04-06-2006, 02:16 PM   · #4
Jim_
NamePros Regular
 
Jim_'s Avatar
 
Name: Jim, of course
Location: Philadelphia
Trader Rating: (20)
Join Date: Aug 2005
Posts: 558
NP$: 14.30 (Donate)
Jim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of light
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.
__________________
woop woop
Jim_ is offline   Reply With Quote
Old 04-06-2006, 03:02 PM   · #5
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 821
NP$: 990.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
your the man. It works, I don't know how to thank you

how can i validate email address?
asgsoft is offline   Reply With Quote
Old 04-07-2006, 01:46 AM   · #6
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 821
NP$: 990.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
here is my email validation script:

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   Reply With Quote
Old 04-07-2006, 04:39 AM   · #7
Jim_
NamePros Regular
 
Jim_'s Avatar
 
Name: Jim, of course
Location: Philadelphia
Trader Rating: (20)
Join Date: Aug 2005
Posts: 558
NP$: 14.30 (Donate)
Jim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of lightJim_ is a glorious beacon of light
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.
__________________
woop woop
Jim_ is offline   Reply With Quote
Old 04-07-2006, 04:49 AM   · #8
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 821
NP$: 990.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
it doesn't seem to work.

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

NamePros is a revenue sharing forum.

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
EscrowDNS free webhosting Proof is in the Parking
Advertise your business at NamePros
All times are GMT -7. The time now is 09:41 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0