| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Regular | Some Javascript help 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?
__________________ |
| |
| | #2 (permalink) |
| NamePros Regular | 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>
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.
__________________ |
| |
| | #3 (permalink) |
| NamePros Member | 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.
__________________ AEInbetween |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |