473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How to define Input Type=text field for Mozilla browser

Hi All,

The following syntax is not working on Mozilla browser, however this
works on IE.

<input id="freq" size="20" name="freq" type="text">

When i refer this freq from a javascript functio like freq.value, its
giving the erro freq not defined in the Javascript console of Mozilla
browser

Thanks
Jul 23 '05 #1
3 2261
On 22 Mar 2005 02:01:01 -0800, Vanitha wrote:
The following syntax is not working on Mozilla browser, however this
works on IE. <input id="freq" size="20" name="freq" type="text"> When i refer this freq from a javascript functio like freq.value, its
giving the erro freq not defined in the Javascript console of Mozilla
browser


document.yourFormName.freq.value

or

document.forms[0].freq.value (if the form which cointains that field is the
first)

or

document.getElementsByName("freq")[0].value

or

document.getElementById("freq").value

and so on :)

--
ZER0

~ The Tangent Universe collapsed 5987 days, 4 hours, 23 minutes and 31 seconds ago.

Jul 23 '05 #2


Vanitha wrote:

The following syntax is not working on Mozilla browser, however this
works on IE.

<input id="freq" size="20" name="freq" type="text">
That is HTML and not JavaScript so it is off topic here but I am sure
Mozilla can render a HTML document containing that markup for an input
type="text" control.
When i refer this freq from a javascript functio like freq.value, its
giving the erro freq not defined in the Javascript console of Mozilla
browser


Learn about the W3C DOM then on how to access elements by their id in
modern browsers:
var input;
if (document.getElementById) {
input = document.getElementById('freq');
}
else if (document.all) {
input = document.all['freq'];
}
// now use the input element object e.g.
if (input) {
input.value = 'Kibology';
}

But for scripting form controls it might be easier and reach more
browsers if you simply use
document.forms.formName.elements.freq.value = 'Kibology'
at least if the <input> sits inside of a
<form name="formName" ...>
ancestor.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3
va*****@agilis.st.com.sg (Vanitha) wrote:
Hi All,

The following syntax is not working on Mozilla browser, however this
works on IE.

<input id="freq" size="20" name="freq" type="text">

When i refer this freq from a javascript functio like freq.value, its
giving the erro freq not defined in the Javascript console of Mozilla
browser


Use document.getElementById("freq") to access this tag:

document.getElementById("freq").value="whatever";

--
Tim Slattery
Sl********@bls.gov
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Christian Colberg | last post by:
Hi, I wanted to know how you can insert text to the left and to the right of a marked part of the word. example: Input field says: ... trees are green ... By marking this text and using a...
6
by: Walter | last post by:
Hi, The user has to type his name into input a input field (type = text). This name must be passed to another ASP file. I did this but nothing happened: <form id=ins method="post"...
2
by: Kai Grossjohann | last post by:
I would like to put a text input field (in the sense of <input type="text">) and an image next to each other, where I know the size in pixels of the image, and I know the total width in em. I...
12
by: Randell D. | last post by:
Folks, I have a form called "ourTestForm". Its a test form - nothing special - it contains five input tags - they are named one, two, three, four and five. The input tags are of type...
1
by: NullBock | last post by:
Hi, I'm trying to create a form with a text-input (not textarea) that expands to the size available, using CSS. I thought that a simple display:block would work: <form> <div> <input...
5
by: Vincent van Beveren | last post by:
Hi everyone, I have a page with a login box. Because of lack of space, instead of labels I put the descriptive text in the input fields (so username input says 'username', and password input...
3
by: kvnsmnsn | last post by:
I've written the following Javascript file that includes an input text field and an output text field, the latter of which is initialized to zero. Each time the user enters a number in the input...
5
by: Yohan Blurp | last post by:
Hi, Here is sample page to show you the problem : <html><body> <form action="/cgi-bin/test.cgi" method="post"> Data Path : <input type="text" size="50" value="C:\Test Data\May 2007.xls"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.