473,795 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting a Text Field on Page Refresh

1 New Member
I have the following simple page. I need to select the BARCODE text field everytime the page refreshes. I know this is pretty basic, but I'm just starting with Javascript. Thanks for the help.

[HTML]<head>

<meta content="http://schemas.microso ft.com/intellisense/ie5" name="vs_target Schema">
<LINK href="css/radevice.css" type="text/css" rel="stylesheet ">
<script language="JavaS cript" src="/scripts/URLhandle.js" type="text/javascript"></script>
<script language="javas cript" src="/scripts/refresh.js" type="text/javascript"></script>
<script language="javas cript">
</script>
<SCRIPT LANGUAGE="JScri pt">
</SCRIPT>

<meta http-equiv="Refresh" content="10"

</head>

<body lang=EN-US style='tab-interval:.5in'>

<div class=Section1>

<h1 align=center

Line:3

</h1>




<table>


<td align=center><F ONT SIZE="4">
Line:3
</td></tr>

<td align=center><F ONT SIZE="4">
<form action="/rokform/WriteLogixTags" method="GET">
Pick Status:
<input type="hidden" name="redirect" value="/user/Web/HH.asp">
<input type="hidden" name="numtags" value="1">
<input type="hidden" name="t_1_tagna me" value="RB3Board Feedback">
<input type="hidden" name="t_1_slot" value="0">
<input type="hidden" name="t_1_type" value="STRING">
<input type="hidden" name="t_1_displ ay" value="String">
<input type="hidden" name="t_1_chang ed" value="1">
<input type="input" name="t_1_value " value="<%ReadLo gixTag("1,0","R B3BoardFeedback ","STRING");%>" >

</form>
</td></tr>



[b]<td align=center width="50%"><FO NT SIZE="4">

<form action="/rokform/WriteLogixTags" method="POST">
BARCODE:
<input type="hidden" name="redirect" value="/user/Web/HH.asp">
<input type="hidden" name="numtags" value="1">
<input type="hidden" name="t_1_tagna me" value="RBGEHH1B CR">
<input type="hidden" name="t_1_slot" value="0">
<input type="hidden" name="t_1_type" value="STRING">
<input type="hidden" name="t_1_displ ay" value="String">
<input type="hidden" name="t_1_chang ed" value="1">
<input type="input" name="t_1_value " value="<%ReadLo gixTag("1,0","R BGEHH1BCR","STR ING");%>">

<input type="submit" name="submit" value="Set Value">
</form>
</td>
</table>


</div>

<p class=MsoNormal ><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>[/HTML]
Jan 5 '08 #1
4 3081
chaarmann
785 Recognized Expert Contributor
just insert:
Expand|Select|Wrap|Line Numbers
  1. <BODY onLoad='document.getElementById("t_1_value").focus();'>
One tip from a long-time expert: don't use generators for your page, just learn HTML and do it manually!
Garbage like
Expand|Select|Wrap|Line Numbers
  1. <p class=MsoNormal><o:p>&nbsp;</o:p></p>
is an indicator that you used Microsoft Word or another microsoft-office-product to make this page!
They are doing nothing except slowing down your page and making modifications very difficult!
Jan 6 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
just insert:
Expand|Select|Wrap|Line Numbers
  1. <BODY onLoad='document.getElementById("t_1_value").focus();'>
That wouldn't quite work because the ID hasn't been set. If the id of the text field is set to "t_1_value" , it should work as expected.

Agree with your tip :)
Jan 7 '08 #3
chaarmann
785 Recognized Expert Contributor
That wouldn't quite work because the ID hasn't been set. If the id of the text field is set to "t_1_value" , it should work as expected.

Agree with your tip :)
But what you said is wrong for IE, I tested it.

example code, test it yourself.:
Expand|Select|Wrap|Line Numbers
  1. <input type=text name="myBox">
  2. <input type=text onChange="alert('You entered above: ' + document.getElementById('myBox').value)"'>
It seems that if an element does not have an "id", but a "name", then
getElementById( ) fetches the element as though the name would be its id.
Jan 8 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
But what you said is wrong for IE, I tested it.

example code, test it yourself.:
Expand|Select|Wrap|Line Numbers
  1. <input type=text name="myBox">
  2. <input type=text onChange="alert('You entered above: ' + document.getElementById('myBox').value)"'>
It seems that if an element does not have an "id", but a "name", then
getElementById( ) fetches the element as though the name would be its id.
Yes, I know that "works", but it's wrong and buggy. document.getEle mentById() should only fetch an element by its ID as its name suggests, not the element's name. This won't work in any of the other browsers.

To fetch an element by its name, we have document.getEle mentsByName().
Jan 8 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
6219
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to make it better soon. Unfortunately, there is never a non-crucial time in which we can do an upgrade, so we are stuck for now. Point 1: There are multiple tables: students, courses, cross-reference
3
2215
by: Roy Adams | last post by:
Hi I'm reposting this question because for some reason can't post follow up question to this thread. What I'm trying to do is put the value and text from a a select in to a text field and to a hidden field respectfully and the value from dynamically created hidden fiields in to a text fieldin to a text field all at the same time Here's the code as viewed through the browser <body bgcolor="#FFFFFF" text="#000000" > <SCRIPT...
0
4237
by: lucas | last post by:
Hi, I have a simple input form that i use to add records to a sql server database. Bellow that is a datagrid that has one template column that I use to dispaly the 3 fields with some html formating. the datagrid also has paging. I'm doing a ASP.NET guestbook. I know some things could be improved like adding some error handling and caching the dataset instead of querying the database on every page load....but I'm still working on the...
1
217
by: pavanp | last post by:
Hi All, I am having a aspx page developed in C# it contains a marquee with some text scrolling. After looping this text for ten time say I am refreshing the page for updating the scrolling text . The problem is that when the page refresh happens the page will be left blank. My requirement is that during the page refresh the text should still be there and I should be able to
9
7799
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't remember that I clicked a button before the refresh. Here is what is going on: 1) Page Loads 2) User enters some values, clicks the "Save" button 3) The onClick event handler for the save button saves the data to the database and the page is...
3
2136
by: JaRudzik | last post by:
Hello Try to add some blank text field and refresh window in IE it is ok but in firefox input hide_show works wrong , why ? Somebody can help me ? I'm not good in JS beacause I'm PHP coder The completly code (mix of PHP and JS):
10
10959
by: Joey_Stacks | last post by:
Does anyone know of a scipt that will rotate random div layers on page refresh? I have a primary content area front and center on my site homepage, and I'd like to rotate various chunks of html (in div layers) each time a user reloads the page. Right now I'm resorting to a random image rotation (those scripts are a dime a dozen) on refresh, but it's far from ideal for what I'm trying to accomplish. Any help on this would be GREATLY...
3
4324
by: dugald.morrow | last post by:
I have some javascript that updates the text in a text field after certain actions take place such as clicking a checkbox. The javascript works fine in Safari and Firefox, but in IE, the text in the text field remains empty. The page containing this problem is at the following location: http://www.skicow.com/component/option,com_skicow/act,shop/Itemid,51/debug_enabled,true The last parameter enables debug which results in alerts...
2
12282
by: qwedster | last post by:
Folks! The following is a "Hello World" kind of code for ViewState. I just want to know how to retain the ViewState 1) while Page Refresh when using UpdatePanel and also 2) While I reverting back to the page after round trip when using UpdatePanel? In the following code snippet the ViewState is killed when I click page refresh or when I go some page and revert back Code Snippet: // Default.aspx:
0
9673
marktang
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...
0
10443
Oralloy
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...
1
10165
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,...
0
10002
tracyyun
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...
1
7543
isladogs
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...
0
6783
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();...
0
5437
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...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.