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 object.

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

_______________________________________________________________

<HTML>
<HEAD>
<TITLE>AS/400 Workstation Gateway </TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="http://000.000.000.000:1077/WSG/509485/QTMTWSG/QTWSG01151";>
<INPUT TYPE="HIDDEN" NAME="SESSION" VALUE="/3D59517242ED521D/39F614F6"><PRE><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*E" VALUE="Enter"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*U" VALUE="Page Up"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*V" VALUE="Page Down"><INPUT TYPE="RESET" NAME="RESET" VALUE="Reset"><INPUT TYPE="SUBMIT" NAME="SPECIALS" VALUE="Close"><INPUT TYPE="SUBMIT" NAME="SPECIALS" VALUE="Refresh"><INPUT TYPE="SUBMIT" NAME="SPECIALS" VALUE="Time"><INPUT TYPE="SUBMIT" NAME="SPECIALS" VALUE="Style"><INPUT TYPE="SUBMIT" NAME="SPECIALS" VALUE="Tips">
<CENTER><H3>AS/400 Workstation Gateway</H3></CENTER>
<HR>
<SELECT NAME="-General-" SIZE=1><OPTION SELECTED VALUE="-NONE-">-General-<OPTION VALUE="*U">Page Up<OPTION VALUE="*V">Page Down<OPTION VALUE="*C">Clear<OPTION VALUE="*A*<">Record Back<OPTION VALUE="*A*X">PA1<OPTION VALUE="*A*Y">PA2<OPTION VALUE="*A*Z">PA3<OPTION VALUE="*A*T">Print<OPTION VALUE="*A*C">Test Request<OPTION VALUE="*S*E">Host print screen<OPTION VALUE="*A*Q">Attention program<OPTION VALUE="*A*H">System requests<OPTION VALUE="*A*H90*E">Sign off<OPTION VALUE="*X">F12<OPTION VALUE="*3">F3</SELECT><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*H" VALUE="Help">
<FONT COLOR="0000FF">ERROS Workgroup Organiser</FONT> <FONT COLOR="0000FF">Rob Dixon </FONT> <FONT COLOR="0000FF">Rob Dixon Collection </FONT>
<BR> <BR> <BR> ERROS Country <BR> name <FONT COLOR="FFFF00"> Public Data</FONT> <INPUT TYPE="TEXT" NAME="AFIELD.007-016" VALUE="" SIZE=64 MAXLENGTH=64>
Selected <FONT COLOR="FF00FF"> </FONT>
<FONT COLOR="YELLOW"><B>To accept, press ENTER; else type new ID & press ENTER</B></FONT><FONT COLOR="BLACK"> <BR> <BR><B>(Page Down for more)</B><BR><SCRIPT LANGUAGE="JavaScript"> var num; var colour; var session=(document.getElementById('SESSION').value); var buttonname = session + "/BUTTON.999-999=*E"; document.getElementById(buttonname).value= "Enter/OK"; var buttonname = session + "/BUTTON.999-999=*U"; document.getElementById(buttonname).value= "Earlier"; colour = "cyan"; function fe() {popup.document.body.style.backgroundColor = colour; popup.document.body.innerHTML = "Left click on ENTER or click on another link"; popup.show(12, 260, 600, 18, document.body)} function fr() {document.getElementById('AFIELD.007-016').value = num} var popup=window.createPopup(); function fp() {popup.document.body.style.backgroundColor = "yellow"; popup.document.body.innerHTML = "Left click on link and click on ENTER below"; popup.show(12, 260, 600, 18, document.body)} </SCRIPT></FONT><FONT COLOR="BLUE"> 1 <A ONMOUSEOVER="fp()"; ONMOUSEDOWN="num='1';fr();fe()"></FONT><FONT COLOR="BLACK">United Kingdom</A> <BR><BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR>ENTER/OK<B><I> Page_Down</B></I> F7=Audit <BR></FONT><FONT COLOR="YELLOW"><B>F2=MSG_Help</FONT><FONT COLOR="BLACK"> F3=RETURN</B></FONT><FONT COLOR="BLUE"> F1=Help F12=Previous F5=Refresh</FONT><FONT COLOR="GREEN"> Server= ERROSIII Task= WORKGROUP</FONT><FONT COLOR="BLACK"> ]END=End_Task ]OFF=Sign_off </FONT>
<INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*E" VALUE="Enter"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*U" VALUE="Page Up"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*V" VALUE="Page Down">
<INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*1" VALUE="F01"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*2" VALUE="F02"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*3" VALUE="F03"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*4" VALUE="F04"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*5" VALUE="F05"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*6" VALUE="F06"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*7" VALUE="F07"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*8" VALUE="F08"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*9" VALUE="F09"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*W" VALUE="F10"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*B" VALUE="F11"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*X" VALUE="F12">
<INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*D" VALUE="F13"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*Y" VALUE="F14"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*F" VALUE="F15"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*G" VALUE="F16"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*Z" VALUE="F17"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*I" VALUE="F18"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*J" VALUE="F19"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*K" VALUE="F20"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*L" VALUE="F21"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*M" VALUE="F22"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*N" VALUE="F23"><INPUT TYPE="SUBMIT" NAME="/3D59517242ED521D/39F614F6/BUTTON.999-999=*O" VALUE="F24">
</PRE>
</FORM>
</BODY>
</HTML>


______________________________________________


Many thanks


Rob Dixon















As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.