UnitedForums - UK Web Hosting Forum UnitedHosting Community Hosting Forums
Network and Server StatusCustomer SupportUK Web Hosting
UnitedHostingUnitedHosting Sitemap UK Hosting ForumUK Web HostingWeb Hosting ForumsUK Reseller HostingWeb Host CommunityUK Managed Dedicated ServersHosting Help and SupportUK Domain Name Registration

Go Back   UnitedForums.co.uk > UnitedHosting Community > Website Development & Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 12th January 2008, 02:51 AM   #1 (permalink)
Charles
Registered User
 
Join Date: Sep 2007
Location: 17°59′N 76°48′W
Posts: 150
java script help

I have a bit of a problem with some java script.

Here is my test page:
https://www.thegiftstoreandmore.com/...e/dropdown.php

I am testing the second dropdown on that page.


When I select Other it will show the 3 text boxes but when I select the drop down to Select One there is a space left between the drop down and the Export Button.

I don't understand why it is doing this.

PHP / HTML Code
PHP Code:
<?php
include("admin/includes/header.inc.php"); 
?>
<br /><br /><br /><br />


<table width="50%" border="1" cellpadding="4" cellspacing="0" class="mainTable">
<tr>
    <td class="tdDBCompare" colspan="1" align="center">
        <select name="selFeed" id="feeds" onchange="feedType(this)"> 
            <option value="">Select One</option> 
            <option value="Mr.">Mr.</option> 
            <option value="Ms.">Ms.</option> 
            <option value="other">Other</option> 
        </select>
    </td>
</tr>



<tr id="otherTitle1" style="display:none;">
    <td class="copyText" width="100%" align="center">
        <input type="text" value="Other Title 1">
    </td>
</tr>

<tr id="otherTitle2" style="display:none;">
    <td class="copyText" width="100%" align="center">
        <input type="text" value="Other Title 2">    
    </td>
</tr>

<tr id="otherTitle3" style="display:none;">
    <td class="copyText" width="100%" align="center">
        <input type="text" value="Other Title 3">    
    </td>
</tr>



<tr>
    <td class="copyText" colspan="2" align="center"><input type="submit" class="submit" name="export" value="<?php echo $lang['admin']['misc']['products_export_cat']?>" />
</td>
</tr>
</table>


<?php include("admin/includes/footer.inc.php"); 
?>

javaScript
PHP Code:
function feedType(obj

//    if (!document.layers) 
//        { 
            
var txt1 document.getElementById("otherTitle1"); 
            var 
txt2 document.getElementById("otherTitle2"); 
            var 
txt3 document.getElementById("otherTitle3"); 

            if (
obj.value == "other"
                { 
                    
txt1.style.display "inline"
                    
txt2.style.display "inline"
                    
txt3.style.display "inline"
//                    txt1.name = "selFeed"; 
//                    txt2.name = "selFeed"; 
//                    txt3.name = "selFeed"; 
                    
obj.name ""
                } else if (
obj.value == "Ms."){
                
                    
txt1.style.display "none"
                    
txt2.style.display "inline"
                    
txt3.style.display "none"
//                    txt1.name = ""; 
//                    txt2.name = "selFeed"; 
//                    txt3.name = ""; 
                    
obj.name ""


                } else { 
                    
txt1.style.display "none"
                    
txt2.style.display "none"
                    
txt3.style.display "none"
//                    txt1.name = ""; 
//                    txt2.name = ""; 
//                    txt3.name = ""; 
                    
obj.name "selFeed"
                } 

//        } 

I don't know anything about JavaScript so I am a bit lost.
Maybe I have something setup wrong in the table in regards to the javascript.
Charles is offline   Reply With Quote
Old 12th January 2008, 02:36 PM   #2 (permalink)
Adam
mmmm I LOVE Apples ;)
 
Adam's Avatar
 
Join Date: Nov 2005
Location: My House
Posts: 1,462
Send a message via AIM to Adam Send a message via MSN to Adam Send a message via Yahoo to Adam
When I select other I get the 3 boxes. When I then pick select one I get nothing. Just how it was when the page was loaded. Should there be something there?
Attached Thumbnails
java-script-help-picture-2.png  
Adam is offline   Reply With Quote
Old 12th January 2008, 08:57 PM   #3 (permalink)
Charles
Registered User
 
Join Date: Sep 2007
Location: 17°59′N 76°48′W
Posts: 150
When you choose Ms it is suppose to show Box 2
but when you choose Other it shows all 3 boxes.
I am using Safari 3.

I think I have the problem figured out though. I have changed the code before you went to the link.

They way I had it before, the cellpadding was causing the issues from what I can tell.
Charles is offline   Reply With Quote
Reply


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

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 08:53 PM.

UK Web Hosting  |  UK Reseller Hosting  |  UK Dedicated Servers UnitedHosting  |  UnitedSupport  |  UnitedForums  |  SEO by vBSEO 3.0.0
Copyright © 1998-2008 United Communications Limited. All Rights Reserved. Registered in England and Wales 3651923 - VAT Reg No. 737662309