Walden
Thank you again for your continued help.
Walden H. Leverich wrote:
Rob,
Do you have control of the <BODY> tag?
No. I can only add scripts & HTML in one or more blocks before the
AFIELD input and also in more or more blocks after the input fields but
before the buttons at the bottom are written out.
Specifically can you add an
onLoad= attribute?
I don't know - does the above help?
The onLoad attribute specifies a function for the
browser to call when it's done loading the page. This would solve two
problems:
1) Since the page was loaded you would be sure that all the elements
were there. Thus the getElementsByName and getElementById would always
work.
2) You could solve your focus problem by using the focus() method:
document.getElementsByName('AFIELD.007-016')[0].focus();
If you can't change the body tag you could also inject some code into
the body tag by placing the following in one of your script blocks:
document.getElementsByTagName("BODY")[0].setAttribute("onLoad",
"DoOnLoad()");
function DoOnLoad()
{document.getElementsByName('AFIELD.007-016')[0].focus();}
This adds the onLoad attribute to the BODY tag and tells it to call
DoOnLoad() it also defines DoOnLoad to set the focus.
I wasn't expecting a solution to the focus problem and am most
grateful. I tried it and it works in NS & Firefox, but not in IE. It
does make a tremendous difference to productivity when it works but the
majority of people use IE so I do need to find a way of getting it going
for IE.
I have tried taking out all the <HR> code and also putting the <HR>
code in a separate script without any obvious effect. If it was missing
in the code I sent you, I must have snipped out too much!
I have also tried taking out defer="true" and this stopped IE from
changing the button text but had no obvious effect in NS. I have not
been able to update the button text in NS whatever I have done. Unless
there is another way to change the button text in IE, I need
defer="true" for IE. Unfortunately I cannot, as standard, put any code
after the form unless someone knows a "clever" way of doing this. Might
putting this into a .js file help?
I wasn't sure what you meant by the wrapped string constants in the fm()
function, but the FM() function does work.
You must have spent considerable time on my problems and I am so
grateful. What I am learning is that there is even more that I don't
understand than I realised!
Could the onload technique for the focus code also be used for the
button changes or can it be used for only one function?
Getting the focus code to work in NS caused me a lot of problems and it
may be help if I explain what I had to do.
Firstly, I copied the generated source code for a page into Notepad, and
then copied and pasted the focus code from your e-mail and it worked in
NS without any change - wonder of wonders!
So I then changed my RPG code to generate the focus code and it would
not work although it seemed that I had typed it correctly.
To check, I copied the relevant part of the code from the Notepad
changed file and the code that I had generated into another Notepad
document and lined them up, one below the other. I could find not
diffence in a character by character comparison. I checked very
carefully and then did it again just in case I had copied the same text
twice. Still no difference. I then copied and pasted your code
directly from your email a little at a time into my RPG source and it
worked. So I did the comparison again and could still find no
difference between any of the versions. I just wondered if I had a
character set problem as I imagine that you and I do not use the same
code pages. Perhaps the same character visually has a different ASCII
or ECBDIC code between our two systems or between my email package and
my AS/400.
It really doesn't seem likely but I really was so careful.
Many thanks
best wishes
Rob
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.