Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2005, 05:58 AM
Friend of Wrox
 
Join Date: Jan 2005
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
 
Old November 10th, 2005, 07:21 PM
Friend of Wrox
 
Join Date: Jun 2003
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 ?





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





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