NameSilo

Some Javascript help

Spaceship Spaceship
Watch

asgsoft

VIP Member
Impact
9
I need to have a dynamic javascript that can work on nearly all platforms.

Basicly you have a check box that says tell a friend. When you check it it shows a drop menu asking the number of friends (Max of 6)

It should display textboxes repeated by the number chosen to enter email address.

I will be putting an email validating script on all textboxes.


How can I acheive that?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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.
 
0
•••
Ok use this to erase text when text box is clicked: onFocus="javascript:this.value='';"

As for the rest I really don't know sorry.
 
0
•••
doesn't work
 
0
•••
try onClick="formname.textboxname.value='';"
 
0
•••
please bare in mind its part of the variable txt
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back