I am pretty much a newbie with javascript, and would like to get a
little clarification on what I can do with an onChange javascript
event handler.
I have a dynamic page I build with perl and print to the browser which
includes some data displayed and edittable in <FORM> elements. There
are a couple areas where I display a message or a calculated total to
the user based on the initial values of some data elements.
I would like to clear or change the "read-only" messages and totals if
certain FORM elements get changed... and am unsure how to approach
this. It looks like if I display the "read-only" information in named
FORM elements I could use onChange event handlers to set the values...
but I don't really want the "read-only" or calculated fields to look
like regular FORM elements or allow editting.
Is there a way to use onChange to either:
- change the text in a specific area of a page that has already been
loaded using document.write( ) ? I am totally unsure if I have an
inline section of javascript that prints out a variable, and I change
the variable via onChange, if the text displayed would change without
refreshing the page.
- put my "calculated " values in FORM elements that look like they are
"read-only" but still allow me to change using the named object
elements?
thanks,
d 1 2599
dan baker a ecrit : I am pretty much a newbie with javascript, and would like to get a little clarification on what I can do with an onChange javascript event handler.
You can change the value of a read-only field via JavaScript
Except on my NC4.5 who doesn't know what is a readonly ...!
It is the only way to do it if you don't want to re-open (and php modify)
Try that :
<html>
<form>
<p><u><b>1st test :</b></u>
<p>a "virtual read only"
<input type=text name="onlyToRea d"
value="Some text to test"
onkeydown="truc =this.value;"
onkeyup="this.v alue=truc;">
<p>to modify the "virtual read only"
<br>Enter your text here :
<input type=text name="modificat or"
onchange="onlyT oRead.value=thi s.value;" >
and quit the field.
<hr>
<p><u><b>2nd test :</b></u>
<p>a "real read only"
<input type=text name="ToReadOnl y"
value="Some text to test"
readonly>
<p>to modify the "real read only"
<br>Enter your text here :
<input type=text name="modificat eur"
onchange="ToRea dOnly.value=thi s.value;" >
and quit the field.
<hr>
<input type=reset value="Reset">
</form></html>
No, you can't document.write on a document allready open
to be compatible with old browsers you must write in text-boxes or text-areas
If old browsers are not concerned
you can use the DOM
<html>
<form>
<p>a "writter on same document" :
<input type=text name="toWrite"
onchange="if(do cument.getEleme ntById)
document.getEle mentById('ToSee ').innerHTML=th is.value;">
<div id="ToSee"></div>
</form></html>
I have a dynamic page I build with perl and print to the browser which includes some data displayed and edittable in <FORM> elements. There are a couple areas where I display a message or a calculated total to the user based on the initial values of some data elements.
I would like to clear or change the "read-only" messages and totals if certain FORM elements get changed... and am unsure how to approach this. It looks like if I display the "read-only" information in named FORM elements I could use onChange event handlers to set the values... but I don't really want the "read-only" or calculated fields to look like regular FORM elements or allow editting.
Yes you have (ie for my NC4.5) to use regular form element.
Is there a way to use onChange to either:
- change the text in a specific area of a page that has already been loaded using document.write( ) ? I am totally unsure if I have an inline section of javascript that prints out a variable, and I change the variable via onChange, if the text displayed would change without refreshing the page.
- put my "calculated " values in FORM elements that look like they are "read-only" but still allow me to change using the named object elements?
thanks, d
--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:st****** *************** @wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS) http://perso.wanadoo.fr/stephane.moriaux/internet/
*************** *************** *************** *************** ** This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jeff |
last post by:
Hi Everyone,
I'm having a problem with onChange. The tag looks like:
<input:text bean = "" name="X" label="Y"
attributesText="onChange=\"clear()\""> </input:text>
if i replace, onChange with onBLur, the call works. when i try using
onchange without the attributesText it tells me onchange is not
supported by the top level domain. if I change the start of the tag
|
by: Asit |
last post by:
In JavaScripts checks for an onChange event against the value of the
textbox at the time of the last onChange event. Since an onChange
Event never fired after you changed the text first time , suppose we
put the same value in the text box then no event is fired.
If we put some other value then it became fired...
It wouldn't fire if we put the same value...
I don't want to use onBlur etc... Isthere any solution with onChange
Event...?
|
by: Christoph |
last post by:
I'm trying to validate some HTML form elements when the
user tabs out of each element. However, I'm having some
problems.
It appears that the order of events is onChange followed
some time afterwards by onBlur. I believe this to be the
case because in my onChange script, if the validation fails,
I force focus back to the field element. However, the focus
still falls to the next field and not back to the field I tried to
force the...
|
by: Bart van Deenen |
last post by:
Hi all
I have a script where I dynamically create multiple inputs and selects
from a script. The inputs and selects must have an associated onchange
handler.
I have the script working fine on Firefox, Safari and Konqueror, but the
onchange event just doesn't fire on IE6.
Firefox's javascript console shows no errors, and the IE script debugger
shows nothing. onchange is not triggered.
|
by: Good Man |
last post by:
Hi there
I'm adding form fields on the fly with some javascript DOM programming.
I basically just clone a hidden <div>, then adjust node properties to
make this new <div> have unique values (style, size, etc.)
the original code of the input tag is:
<input type="file" onchange="alert('original')" size="30" id="filea"
name="filea">
| |
by: jab3 |
last post by:
Hello. I"m new to this group, and to JavaScript in general, so please
forgive me if I breach local etiquette. I'm trying to implement some
client-side 'dynamic' validation on a form. I'm having a couple of
problems, which I'll try to describe. But this e-mail will only
reproduce one of them, in a "short" example. What I'm generally doing
is having each form entry contained in a div, which as a label, an
input with some event handlers,...
|
by: b_naick |
last post by:
I realize that the onChange event for a drop down can be trapped as
follows:
<select name="myDropDown" onChange="somefunc">
Is it possible to trap the onChange event outside of the select
statement? Something like this:
document.forms.myDropDown.onChange = somfunc;
|
by: Leena P |
last post by:
i want to basically take some information for the product and let the user
enter the the material required to make this product
1.first page test.php
which takes product code and displays prodcut anme have used
ajax to avoid refreshing of page this works fine
2.now i have created one row with
checkbox|select box|text|text|text|text|
where in the select box values are fetched from table here also i have used ajax for getting the m_name...
|
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: 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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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...
| |