473,327 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Selecting a Text Field on Page Refresh

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.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="css/radevice.css" type="text/css" rel="stylesheet">
<script language="JavaScript" src="/scripts/URLhandle.js" type="text/javascript"></script>
<script language="javascript" src="/scripts/refresh.js" type="text/javascript"></script>
<script language="javascript">
</script>
<SCRIPT LANGUAGE="JScript">
</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><FONT SIZE="4">
Line:3
</td></tr>

<td align=center><FONT 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_tagname" value="RB3BoardFeedback">
<input type="hidden" name="t_1_slot" value="0">
<input type="hidden" name="t_1_type" value="STRING">
<input type="hidden" name="t_1_display" value="String">
<input type="hidden" name="t_1_changed" value="1">
<input type="input" name="t_1_value" value="<%ReadLogixTag("1,0","RB3BoardFeedback","ST RING");%>">

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



[b]<td align=center width="50%"><FONT 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_tagname" value="RBGEHH1BCR">
<input type="hidden" name="t_1_slot" value="0">
<input type="hidden" name="t_1_type" value="STRING">
<input type="hidden" name="t_1_display" value="String">
<input type="hidden" name="t_1_changed" value="1">
<input type="input" name="t_1_value" value="<%ReadLogixTag("1,0","RBGEHH1BCR","STRING") ;%>">

<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 3038
chaarmann
785 Expert 512MB
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 Expert Mod 8TB
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 Expert 512MB
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 Expert Mod 8TB
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.getElementById() 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.getElementsByName().
Jan 8 '08 #5

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

Similar topics

7
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...
3
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...
0
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...
1
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...
9
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...
3
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 ...
10
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...
3
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.