Hi,
Ran into the following problem while trying to have a code to
attach a Virtual Keyboard to any user's form:
User clicks a button and my JavaScript changes outerHTML
of say <textarea - adding things like ONCLICK='saveCa ret(this)'
etc. and it also tries to save any text that user could've entered
before the button press.
a) Value - (already typed text) is not assigned back
b) outerHTML is still the same - both in alert() text and via
javascript:x=do cument.body.inn erHTML.replace(/</g,'<').repla ce(/\n/g,'<br>'); document.body.i nnerHTML = x;
The code is simple so I wander whether we have a way to force HTML to be
re-avaluated/re-parsed via a button click
(if I do the same via <script....</scriptline placed above the button
then everything is OK - because HTML is being changed _before_ the
page load is over)
=============== =============== =========
function vkb_addAttribut es(obj)
{
var obj_value = ""; if (obj.value != "") obj_value = obj.value;
var kA=" onFocus='vkb_tx tControl=this;' OnSelect='vkb_s aveCaret(this)' ";
var obj_HTML = obj.outerHTML;
var pos = obj_HTML.indexO f('>');
var part1 = obj_HTML.substr ing(0,pos);
var part2 = obj_HTML.substr ing(pos);
obj.outerHTML = part1 + kA + part2;
obj.value = obj_value;
}
=============== =============== ===============
Thanks,
Paul 51 4421
Paul Gorodyansky wrote:
User clicks a button and my JavaScript changes outerHTML
of say <textarea - adding things like ONCLICK='saveCa ret(this)'
etc. and it also tries to save any text that user could've entered
before the button press.
Why are you adding to the elements onclick in reaction to a user click?
Is it that the user has many choices, and each choice assigns a
different event to the element's onclick? If not, then you should just
add to the elements onclick onload, with something like this: http://simon.incutio.com/archive/200...6/addLoadEvent
function addLoadEvent(fu nc) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(na meOfSomeFunctio nToRunOnPageLoa d);
addLoadEvent(fu nction() {
/* more code to run on page load */
});
Hi,
Jake Barnes wrote:
>
Paul Gorodyansky wrote:
User clicks a button and my JavaScript changes outerHTML
of say <textarea - adding things like ONCLICK='saveCa ret(this)'
etc. and it also tries to save any text that user could've entered
before the button press.
Why are you adding to the elements onclick in reaction to a user click?
Is it that the user has many choices, and each choice assigns a
different event to the element's onclick?
No, just sample onclick.
But I want to add them to <textarea NOT on page load, but later -
when a user clicks on my button (because s/he may never need
Virtual Keyboard - why them should I change input fields HTML?)
Please see 1st message once more to see what I mean.
--
Regards,
Paul
Yes, by the way, you need some SOAP and AJAX, pun intended :), SOAP
a metadata file in markup, your HTML fragment, and AJAX, Asynchronous
Javascript And XML, nevermind the XML part, it really manages
anything ASCII, but originally intended for XML, though it does XML
metadata as nodes as well. The Asynchronous means, you don't serve
the fragment(s) on pageload, or at once upon pageload or preloaded
synchronously with the page, you do it asynchronously, at a later
time, in this case, by onclick, to load the metadata string in html
markup from the server upon the event. One used by many is the
"Prototype" set, which is a premade one for requesting files
asynchronously to the webserver. Just google for it.
Danny
Paul Gorodyansky wrote:
Hi,
Ran into the following problem while trying to have a code to
attach a Virtual Keyboard to any user's form:
User clicks a button and my JavaScript changes outerHTML
of say <textarea - adding things like ONCLICK='saveCa ret(this)'
etc. and it also tries to save any text that user could've entered
before the button press.
a) Value - (already typed text) is not assigned back
b) outerHTML is still the same - both in alert() text and via
javascript:x=do cument.body.inn erHTML.replace(/</g,'<').repla ce(/\n/g,'<br>'); document.body.i nnerHTML = x;
As far as I know , you can just add or modify the element's
attribute to accomplish what you want . You needn't to
let the explorer to re-parse the HTML !
Bo Yang wrote:
>
As far as I know , you can just add or modify the element's
attribute to accomplish what you want . You needn't to
let the explorer to re-parse the HTML !
It's what I thought, too but no, it does not work if my change
function is called on a button click - Source shows that HTML code
of <textarea was not changed
I tried in both IE and Firefox. It's why I asked
"how to force browser to re-parse HTML _after_ the page load is over -
on a button's click"
--
Regards,
Paul
Hi,
Danny wrote:
>
Yes, by the way, you need some SOAP and AJAX, pun intended :), SOAP
a metadata file in markup, your HTML fragment, and AJAX, Asynchronous
Javascript And XML, nevermind the XML part, it really manages
anything ASCII, but originally intended for XML, though it does XML
metadata as nodes as well. The Asynchronous means, you don't serve
the fragment(s) on pageload, or at once upon pageload or preloaded
synchronously with the page, you do it asynchronously, at a later
time, in this case, by onclick, to load the metadata string in html
markup from the server upon the event. One used by many is the
"Prototype" set, which is a premade one for requesting files
asynchronously to the webserver. Just google for it.
Danny
No, I can not use any _server_ stuff - need to solve using only client
things - browser and JavaScript
--
Regards,
Paul
I am not sure why you need to modify the HTML to add a JS event
handler. Just add the event handler in JS like this:
myelement.onloa d = myfunction;
function myfunction()
{
}
Paul Gorodyansky wrote:
Hi,
Jake Barnes wrote:
Paul Gorodyansky wrote:
User clicks a button and my JavaScript changes outerHTML
of say <textarea - adding things like ONCLICK='saveCa ret(this)'
etc. and it also tries to save any text that user could've entered
before the button press.
Why are you adding to the elements onclick in reaction to a user click?
Is it that the user has many choices, and each choice assigns a
different event to the element's onclick?
No, just sample onclick.
But I want to add them to <textarea NOT on page load, but later -
when a user clicks on my button (because s/he may never need
Virtual Keyboard - why them should I change input fields HTML?)
You add the event handler on page load. That is, once the page is
loaded, add a function to the textarea's event handlers. Do you want
something to happen when focus shifts to the textarea? Then add a
function to the onfocus event of the textarea (add it on page load to
ensure the HTML of the textarea is really there).
Or if you really want to add it to the button, then add it to the
onclick of the button on page load.
Can we see the page? A url?
Hi,
Sorry, was out of town
Jake Barnes wrote:
>
Paul Gorodyansky wrote:
Hi,
Jake Barnes wrote:
>
Paul Gorodyansky wrote:
User clicks a button and my JavaScript changes outerHTML
of say <textarea - adding things like ONCLICK='saveCa ret(this)'
etc. and it also tries to save any text that user could've entered
before the button press.
>
...
But I want to add them to <textarea NOT on page load, but later -
when a user clicks on my button (because s/he may never need
Virtual Keyboard - why them should I change input fields HTML?)
You add the event handler on page load. That is, once the page is
loaded, add a function to the textarea's event handlers.
It's what I was doing (see above) - by changing outerHTML of that
<textarea. How else can I add eventhandler? I saw some other methods
but they were "Internet Explorer only"
So if I add an eventhandler such as say onfocus or onclick this way
then everything works Ok:
<script type="text/javascript">vkb _Init();</script>
because the page is still under evaluation by the browser so it 'sees'
that some new handlers have been added.
But if I want to avoid having such line as above and what to perform
same vkb_Init() when a user clicks a button then those additional
eventhandlers are NOT seen by browser (for example,
javascript:x=do cument.body.inn erHTML.replace(/</g,'<').repla ce(/\n/g,'<br>'); document.body.i nnerHTML = x;
does not show them) - they do NOT work -
it seems that "it's too late to add eventhandlers"
So this does not work:
Or if you really want to add it to the button, then add it to the
onclick of the button on page load.
and this is why I asked the question the way I did - how to force
a browsers to re-look at a text object to realize that some new
eventhandlers have been added.
Can we see the page? A url?
http://RusWin.net/vkbFly2e.htm
--
Regards,
Paul Gorodyansky
"Cyrillic (Russian): instructions for Windows and Internet": http://RusWin.net
Russian On-screen Keyboard: http://Kbd.RusWin.net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: infidel |
last post by:
I may have found the source of my infinite loop when importing kid
modules from my cherrypy server. Here is some code from the
autoreloader module of cherrypy:
def reloader_thread():
mtimes = {}
def fileattr(m):
return getattr(m, "__file__", None)
|
by: Clark Spencer |
last post by:
I have built a small integration app using VS .NET 2003 that extracts
orderinformation from a 'webshop'. Extracting the orderinformation works fine.
Appending the order elements in the XmlDocument was also done in a jiffy.
The final step is to save the document to disk and then ship it to another
system using ftp. The xml orderfile produced must fit a set specification of
the recieving system. That specification states that empty elements...
|
by: craig |
last post by:
Assume that you have a User object, which abstracts an authenticated user of
your application. It has some properties such as UserID, FirstName,
LastName, etc. and a method LogOut(); The LogOut method logs the user out
of the application. If the LogOut() method is successful, the user is
logged out and the User object should no longer be valid. Is there a way to
allow the LogOut() method to force the reference that is being held to the...
|
by: Steve Franks |
last post by:
According to the docs you tell ASP.NET to use cookieless sessions by setting
a value in the config.web file.
However, what if I wanted to determine at run time whether or not I wanted
to use cookieless sessions for a particular user, and if so, I'd instruct
ASP.NET to turn on cookieless sessions for a particular user session. Is
this possible?
For example I want to use cookie based sessions by default for all users.
But if a user has...
|
by: nightowlky |
last post by:
Is it possible to force a file (opened on a local drive of a machine)
to be closed in order that it may be written to with updates?
| |
by: Mark A |
last post by:
DB2 ESE 8.2.3 (FP10) for Linux
We are experiencing a connection hang of 10 - 15 minutes in the following
HADR and automatic client reroute scenario:
01 server is primary database
02 server is standby database
a. applications connected to database on 01 server
b. shutdown 01 server
|
by: gregory_may |
last post by:
Is it possible to force a limit on the amount of CPU a task is taking?
I am thinking of writing a simple app that will let me force other
applications to "be nice" by only using so much CPU.
Is this possible ... does anything like this exist?
|
by: comp.lang.php |
last post by:
I have a form that when you click the "Generate Report" submit button,
it will force download a CSV file, required for this project.
On the very same page you also have a "Search" submit button, when you
press it it should generate search results in a new page.
However, when you click the "Generate Report" submit button, the moment
you try to THEN click the "Search" submit button, the "Search" submit
button NEVER goes to a new page but...
|
by: scoe |
last post by:
In designing a application to update firmware, I require to reset the
hardware. Is their any command or method to force a reset of the device.
|
by: Hubert Fritz |
last post by:
Hello,
I fear I want to have something which is not possible in C++.
How is it possible to define a base class so that the derived
class is forced to contain a static member variable, which can
be used by static member functions of the base class?
Something like
virtual static XClass* pXClass;
/* pXClass shall be pure virtual, so not static in base class, but
|
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: 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: 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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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.
| |