Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 9th, 2005, 05:58 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default check if element is disabled or enabled

Code:
function showSeats(passType,passNo,id)
{
    var segments = document.form.segments.value;

    if (passType == "ADT")
    {
        var pass = "adt";
        var el = document.getElementById("helpTxtFl_adt");
    }
    else if (passType == "CHD")
    {
        var pass = "chd";
        var el = document.getElementById("helpTxtFl_chd");
    }

    if (document.form.enabled.value == "true")
    {
        el.innerHTML = "Seats: "
        el.className = "font2";
        el.style.visibility = "visible";

        for (s=1; s<=segments; s++)
        {
            el.innerHTML += s + ":&nbsp;";
            if (document.forms["form"].elements[pass+passNo+":"+s].value != "")
            {
                el.innerHTML += document.forms["form"].elements[pass+passNo+":"+s].value + "&nbsp;|&nbsp;";
            }
            else 
            {
                el.innerHTML += "--&nbsp;|&nbsp;";
            }
        }
    }    
}

<img src="images/info_white.gif" id="adt_info1" class="opaque" 
onMouseOver="showSeats('ADT','1',this.id); style.cursor='hand';"
onMouseOut="message_help('','ADT');"
title="Please select a seat for <% if noa > 1 then response.Write "Adult Passenger 1" else response.Write "the Adult Passenger" end if %>" disabled />
is there any way, inside function showSeats, that I can check if the id that i am passing to it (id) is disabled or enabled?
If it is enabled is wish to run these lines:
el.innerHTML = "Seats:&nbsp;"
        el.className = "font2";
        el.style.visibility = "visible";

        for (s=1; s<=segments; s++)
        {
            el.innerHTML += s + ":&nbsp;";
            if (document.forms["form"].elements[pass+passNo+":"+s].value != "")
            {
                el.innerHTML += document.forms["form"].elements[pass+passNo+":"+s].value + "&nbsp;|&nbsp;";
            }
            else
            {
                el.innerHTML += "--&nbsp;|&nbsp;";
            }
        }
if it is disabled, i would like to not run them.

Thanks.

Picco

www.crmpicco.co.uk
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote
  #2 (permalink)  
Old November 10th, 2005, 07:21 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: High Wycombe, UK, United Kingdom.
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

can you not use the .DISABLED boolean attribute of the form element you are looking at ?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger Enabled or Disabled? smshinde Oracle 2 March 1st, 2007 06:02 AM
Check if string is in element hykyit XSLT 3 May 1st, 2006 09:26 AM
check if an array element is not undefined crmpicco Javascript How-To 1 October 6th, 2005 11:40 AM
check if .framework is enabled on webserver marian General .NET 1 November 18th, 2004 09:00 AM



All times are GMT -4. The time now is 12:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.