| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Regular | Show and hide a textfield based on a selectbox I am using this JS to show and hide a textbox when the value for the select box changes. It shows the textbox alright, but when I want to hide it it won't. Here is what I have: Code: function showField(email_div)
{
var txt = "";
if(document.form1.type.value = "Banner Impressions")
{
txt += "<p>Banner Location:<input type='text' name='bannerloc' value='<?php echo $firstname; ?>' onfocus=\"this.value='';\" /></p>";
document.getElementById(email_div).innerHTML = txt;
}
else
{
txt = null;
document.getElementById(email_div).innerHTML = nill;
}
}
__________________ |
| |
| | #2 (permalink) |
| Stud Sausage | Hi asgsoft. Can i assume email_div is the layer you wish to hide? Technically you are not hiding anything here, in affect you are you are removing it. Remember that is is null not nill btw ![]() PHP Code: |
| |
| | #5 (permalink) |
| NamePros Regular | Code: function showField(email_div)
{
if(document.form1.type.value = "Banner Impressions")
{
var txt = '<p>Banner Location:<input type="text" name="bannerloc" value="<?php echo $firstname; ?>" onfocus="this.value=\'\';" /></p>';
document.getElementById(email_div).innerHTML = txt;
document.getElementById(email_div).style.display = 'block';
}
else
{
document.getElementById(email_div).style.display = 'none';
}
}
__________________ -Beaver6813.com V5 Soon! |
| |
| | #7 (permalink) |
| Stud Sausage | Right that helped ![]() Look at your option again: Code: <option value="banner">Banner Impressions</option> Code: if(document.form1.type.value = "Banner Impressions") Code: if(document.form1.type.value == "banner") PHP Code: |
| |
| | #8 (permalink) |
| NamePros Regular | thanks a lot. That's fixed now. Can you have a look at the price section? http://asgsoft.net/form/form.php It should make the price change, it only works when i have one price set, when I have all of them then it doesn't work. Where have i gone wrong?
__________________ Last edited by asgsoft; 01-03-2007 at 08:00 AM. |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |