|
the javascript code is placed to high in the page the browser executes it before the buttons at the bottom are created
place the folowing code after the end of the form function cbt(letter, newText) { var buttons = document.forms[0].elements[session + "/BUTTON.999-999=*" + letter]; for (var i=0;i<buttons.length;i++) { buttons[i].value = newText; } } cbt('E', "Enter/OK"); cbt('U', "Earlier");
try mozilla browser http://www.mozilla.org, it has a much better javascrit debugger than IE
nicolas
"Rob Dixon" <rob.dixon@xxxxxxxxxxx> a écrit dans
le message de news:3FFC1693.1030906@xxxxxxxxxxxxxx
object.Using Javascript, I am trying to change the text displayed on buttons generated by AS/400 WSG, from F1, F2, etc. to my own labels.
The buttons include the session name as part of their own name, followed by "/BUTTON.999.999="?", so I have to retrieve this.
The question mark represents a unique character such as "E" or "U" or "V" or "1", etc.
To retrieve the session name, my code is
var session=(document.getElementById('SESSION').value);
I use
var buttonname = session + "/BUTTON.999-999=*E"; (for the Enter button)
to identify the the button I require, using "E" or "U" or "V" instead of the questions mark.
The code that actually changes the button text is
document.getElementById(buttonname).value= "Enter/OK";
This works fine and I can change the first three buttons at the top of the screen , but my code only changes the top instances of those buttons, not the repeats with the same name at the bottom of the screen.
However, these are not the buttons I wish to change. If I attempt change any of the F1 - F24 buttons by using the same code but by changing the
code
var buttonname = session + "/BUTTON.999-999=*E"; (for the Enter button) to (say) var buttonname = session + "/BUTTON.999-999=*1"; (for the F1 button)
I get the message 'document.getElementById(...)' is null or not an
It may be a coincidence that the only buttons that I can change are the duplicates at the top of the screen
Has anyone got any bright ideas please? I have only doing Javascript for 5 days and I cannot find the answer in any of the books that I purchased.
the total code (which could be neater but I want to get it to work first!) is
_______________________________________________ This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/web400 or email: WEB400-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/web400.
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.