Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Accessing a field variable with spaces in it.. HELPPPPPPPPP !!!!

Reply
Thread Tools

Accessing a field variable with spaces in it.. HELPPPPPPPPP !!!!

 
 
Pooj
Guest
Posts: n/a
 
      08-12-2004
I have a form having field as below :

<input type="text" maxlength="12" id="attributes1" name="Alert Code"
value="001" onChange="convert(this)">

I want to alert the value inputted by the user in this field. The form
name is MainForm. I used :

alert(document.MainForm["0_Alert Code"].value)

But it is giving some wiered numbers like 91807168

What does this mean How Can i alert the value entered ?

Please help this is very urgent !!!
 
Reply With Quote
 
 
 
 
Hywel
Guest
Posts: n/a
 
      08-12-2004
In article <(E-Mail Removed) >, Pooj
says...
> I have a form having field as below :
>
> <input type="text" maxlength="12" id="attributes1" name="Alert Code"
> value="001" onChange="convert(this)">
>
> I want to alert the value inputted by the user in this field. The form
> name is MainForm. I used :
>
> alert(document.MainForm["0_Alert Code"].value)


What's the "O_" for in that?

--
Hywel

http://sponsorhywel.org.uk/
 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      08-12-2004
Pooj wrote:
> I have a form having field as below :
>
> <input type="text" maxlength="12" id="attributes1" name="Alert Code"
> value="001" onChange="convert(this)">




> I want to alert the value inputted by the user in this field. The form
> name is MainForm. I used :


Since you are passing a reference to the convert function, you can
simply use that reference:

function convert(fieldRef){
alert(fieldRef.value)
}

> alert(document.MainForm["0_Alert Code"].value)
>
> But it is giving some wiered numbers like 91807168


since you use 0_Alert Code in the script but Alert Code in the HTML, its
totally surprising you got the alert at all.

> What does this mean How Can i alert the value entered ?
>
> Please help this is very urgent !!!


Everything is "urgent" until you are dead, then it doesn't matter anymore.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[CSS] how can I show spaces as spaces? Tomasz Chmielewski HTML 21 09-10-2009 06:43 PM
how can I show spaces as spaces, part 2 Tomasz Chmielewski HTML 14 09-10-2009 03:54 PM
Re: How to trim a String trailing spaces, but not leading spaces? Roedy Green Java 3 09-14-2008 02:10 AM
Re: How to trim a String trailing spaces, but not leading spaces? John B. Matthews Java 4 09-12-2008 05:28 AM
Use Mic Modem In Hyperterminal Please Helppppppppp indande Computer Support 0 09-29-2006 01:48 PM



Advertisments