im pretty ne to java script - so please be gentle :)
basically what i want to do is construct an action in a function using a
variable sent to that function
ok - what i want to do is
function ($number)
{
form1.button[add in the $number here].disabled=true;
}
say $number was 34, so in effect i would end up with
function ($number)
{
form1.button34. disabled=true;
}
i have tried all sorts but cnt seem to get the result i want - any advice
would be great 6 1427
chris wrote: im pretty ne to java script - so please be gentle :)
basically what i want to do is construct an action in a function using a variable sent to that function
ok - what i want to do is
function ($number) { form1.button[add in the $number here].disabled=true; }
say $number was 34, so in effect i would end up with
function ($number) { form1.button34. disabled=true; }
i have tried all sorts but cnt seem to get the result i want - any advice would be great
I believe the effect you want to achieve is the following:
function myFunc(btnNum)
{
document.forms["formName"].elements["button" + btnNum].disabled =
true;
}
Hope this helps. :)
chris said: im pretty ne to java script - so please be gentle :)
It's Javascript, not "java script". The distinction is important
because otherwise people get the impression that it is somehow
related to Java.
basically what i want to do is construct an action in a function using a variable sent to that function
ok - what i want to do is
function ($number) { form1.button[add in the $number here].disabled=true; }
say $number was 34, so in effect i would end up with
function ($number) { form1.button34. disabled=true; }
i have tried all sorts but cnt seem to get the result i want - any advice would be great
form1.button34. disabled is not a string. It's a reference in "dot notation",
and may not include variables. To do what you want, you need to use "square
bracket notation". You should also always refer to forms in relation to the
document, not as if the form reference was a global variable:
function disableButton(n ) {
document.form1. elements["button"+n].disabled=true;
}
Thanks All, just wat i needed to know
--
¼á
"Lee" <RE************ **@cox.net> wrote in message
news:dg******** *@drn.newsguy.c om... chris said: im pretty ne to java script - so please be gentle :)
It's Javascript, not "java script". The distinction is important because otherwise people get the impression that it is somehow related to Java.
basically what i want to do is construct an action in a function using a variable sent to that function
ok - what i want to do is
function ($number) { form1.button[add in the $number here].disabled=true; }
say $number was 34, so in effect i would end up with
function ($number) { form1.button34. disabled=true; }
i have tried all sorts but cnt seem to get the result i want - any advice would be great
form1.button34. disabled is not a string. It's a reference in "dot notation", and may not include variables. To do what you want, you need to use "square bracket notation". You should also always refer to forms in relation to the document, not as if the form reference was a global variable:
function disableButton(n ) { document.form1. elements["button"+n].disabled=true; }
["Followup-To:" header set to alt.comp.lang.j avascript.]
On 2005-09-21, chris <so*****@here.c om> wrote: im pretty ne to java script - so please be gentle :)
basically what i want to do is construct an action in a function using a variable sent to that function
ok - what i want to do is
function ($number) { form1.button[add in the $number here].disabled=true; }
say $number was 34, so in effect i would end up with
function ($number) { form1.button34. disabled=true; }
this appears to be what you are trying to di,
it may work (I have not tested it).
but it is non-standard and will cause warnings in mozilla, and may not at all in
other browsers.
function ($number)
{
eval("form1.but ton"+$number+". disabled=true;" );
}
you should be using document.GetEle mentById
this means giving any element you want to refer to an id tag.
that means you can have non-submitted form inputs by not giving
them a name tag.
Bye.
Jasen
Jasen Betts said: ["Followup-To:" header set to alt.comp.lang.j avascript.] On 2005-09-21, chris <so*****@here.c om> wrote: im pretty ne to java script - so please be gentle :)
basically what i want to do is construct an action in a function using a variable sent to that function
ok - what i want to do is
function ($number) { form1.button[add in the $number here].disabled=true; }
say $number was 34, so in effect i would end up with
function ($number) { form1.button34. disabled=true; }
this appears to be what you are trying to di, it may work (I have not tested it). but it is non-standard and will cause warnings in mozilla, and may not at all in other browsers.
function ($number) { eval("form1.but ton"+$number+". disabled=true;" ); }
you should be using document.GetEle mentById
this means giving any element you want to refer to an id tag. that means you can have non-submitted form inputs by not giving them a name tag.
You should never use eval() to access a form element, and using
getElementById( ) is usually almost as bad. Use:
document.form1. elements["button"+$numbe r].disabled=true;
Jasen Betts said the following on 10/15/2005 8:48 PM:
["Followup-To:" header set back to the legitimate comp.lang.javas cript.] ["Followup-To:" header set to alt.comp.lang.j avascript.] On 2005-09-21, chris <so*****@here.c om> wrote:
im pretty ne to java script - so please be gentle :)
basically what i want to do is construct an action in a function using a variable sent to that function
ok - what i want to do is
function ($number) { form1.button[add in the $number here].disabled=true; }
say $number was 34, so in effect i would end up with
function ($number) { form1.button34. disabled=true; }
this appears to be what you are trying to di, it may work (I have not tested it). but it is non-standard and will cause warnings in mozilla, and may not at all in other browsers.
function ($number) { eval("form1.but ton"+$number+". disabled=true;" ); }
As Lee pointed out, NEVER use eval to access form elements.
you should be using document.GetEle mentById
syntax error. It is document.getEle mentById
this means giving any element you want to refer to an id tag. that means you can have non-submitted form inputs by not giving them a name tag.
Or, you get both by giving it a name *attribute*, then use the forms
collection to access it.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jack |
last post by:
Hi,
I need to pass multple variables in a link in order to go to a asp page with
the
two varables.
The following are the values of the variables using response.write:
<%'Response.Write Mypage & "<br>"%>
Exp
<%'Response.Write GrantID & "<br>"%>
|
by: James |
last post by:
Can anyone please shed some light on the following...
I have a framework that uses dynamically created tables, named using an
incremental "attribute set ID", as follows:
attrdata_1
attrdata_2
attrdata_3
etc, etc...
|
by: Ross A. Finlayson |
last post by:
Hi,
I'm scratching together an Access database. The development box is
Office 95, the deployment box Office 2003.
So anyways I am griping about forms and global variables. Say for
example I'm adding a customer. The Customer fields are mostly foreign
keys that refer to primary keys in other tables, left join instead of
junction tables at this point. So, when I want to add a customer
record, I also need to add records to the other...
|
by: robbie.carlton |
last post by:
Hello!
I've programmed in c a bit, but nothing very complicated. I've just
come back to it after a long sojourn in the lands of functional
programming and am completely stumped on a very simple function I'm
trying to write. I'm writing a function that takes a string, and
returns an array of strings which are the result of splitting the input
on whitespace and parentheses (but the parentheses should also be
included in the array as...
|
by: Ryan Smith |
last post by:
I am trying to store a string into a string variable via the following code
however am receiving an error and cant figure out what i am doing wrong. Any
feedback is greatly appreciated.
Line 49: Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Button1.Click
Line 50:
Line 51: Dim strSQL As String = "INSERT INTO Investors
(FNAME,LNAME,EMAIL,ADDRESS1,ADDRESS2," & _
| |
by: Ian Davies |
last post by:
Hello
I am trying to update a session, ie everytime the page is resubmitted I want
the current selected value from a list to be appended to the old session
value. I have the following code but am unable to get it to work. I dont
know the correct syntac wher I have put the word 'PLUS'.
<?php $_SESSION = $_SESSION PLUS
$_POST;?>
I have tried & but this doesnt work, or even && which I have seen in some
|
by: Supermansteel |
last post by:
I am joining these 2 tables together in Access 2003 and can't figure out the exact way of writing this script......Can anyone help?
I have the following SQL:
SELECT PL_Input.Date_ID,Count(PL_Input.+PL_Input.+PL_Input.+PL_Input.+PL_Input.) AS
FROM Country INNER JOIN PL_Input ON Country.Country_ID = PL_Input.Country_ID
WHERE (((. & "" & . & "" & . & "" & . & "" & .) Like "*2*"))
|
by: SUBHABRATA |
last post by:
Dear Group,
I am trying the following code line:
def try2(n):
a1=raw_input("PRINT A STRING:")
a2=a1.split()
a3="God Godess Heaven Sky"
for x in a2:
a4=a3.find(x)
if a4>-1:
a5=a3
|
by: sam.barker0 |
last post by:
Hi,
I tried to use the java approach to join 2 strings
int w=0;
string z="blah " + w + "blah "
but this gives me an error
but this works
string z("blah");
z+=w;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |