473,545 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting initial focus in html using Javascript - Pocket IE on Windows 2003 Pocket PC

This HTML has a bit of Javascript at the end that puts the initial
focus on the userID field. It works great on Windows2000 running IE6,
but the initial focus never goes to the userID field on Windows 2003
PocketPC (Windows Mobile) running Pocket IE.

<html><head><ti tle>WMS - P280WF100 - Login</title><META
HTTP-EQUIV='expires' VALUE='0'>
</head>
<body>
<form name="frmLogon" action='p280wp1 00' method='get'>
<table>
<tr>
<td>User ID</td>
<td>
<input id='userID' name='userID'
type='text'
maxlength=10
size=10
</input></td>
</tr>
<tr>
<td>Password</td>
<td>
<input id='password' name='password'
type='password'
maxlength=10
size=10

</input></td>
</tr>

<tr>
<td colspan=2><cent er><input type='submit' accesskey='L'
value='Login'></center></input></td>
</tr>
</table>
</form>

<hr>
<script language=javasc ript>
function window.onload() {window.frmLogo n.userID.focus( );}
</script>
</body></html>
Jul 23 '05 #1
2 7503
dsnyder wrote:
This HTML has a bit of Javascript at the end that puts the initial
focus on the userID field. It works great on Windows2000 running IE6,
but the initial focus never goes to the userID field on Windows 2003
PocketPC (Windows Mobile) running Pocket IE.
I have only had one short opportunity to examine a Pocket IE but it was
rapidly obvious that it was not a cut down version of desktop IE (and
not surprisingly so, as desktop IE is enormous). It seems likely that
creating code to work on Pocket IE should be done following general
cross-browser coding principles, so avoiding IE-isms and avoiding any
reliance on the error correcting behaviour of desktop IE (best achieved
by validateing HTML source code).

<snip> <input id='userID' name='userID'
type='text'
maxlength=10
size=10
> </input></td>

^^^^^^^^
Input elements are empty, they do not have a closing tag.

<snip> ... <center><inpu t type='submit' accesskey='L'
value='Login'></center></input> ...
The DOM created for scripting from HTML has a tree-like structure, and
formally valid HTML also has a tree-like structure (allowing an easy
translation from HTML into a DOM). But above you have and opening CENTER
tag, and opening INPUT tag, a closing CENTER tag and then a closing
INPUT tag. The closing INPUT tag is invalid anyway (as I mentioned
above) but what is the browsers supposed to make of this strange
overlapping of elements? Desktop IE error-corrects it (it has no choice
as this is the sort of nonsense HTML that Microsoft Word outputs as a
matter of course), but I am told that 50% of desktop IE's code is
error-correcting and then will just not fit into Pocket IE.

<snip> <script language=javasc ript>
Valid HTML 4 requires that script elements have a type attribute,
rendering the language attribute redundant.

<script type="text/javascript">
function window.onload() {window.frmLogo n.userID.focus( );}

<snip>

ECMA 262 (3rd edition) specifies a function declaration as having an
identifier as a function name, not a property accessor. This is another
IE-ism, and maybe Pocket IE does not understand it. Cross-browser code
would assign a function expression to the - window.onload - property.

Accessing named forms as properties of the global (window) object is not
cross-browser either. Accessing forms as named members of the -
document.forms - collection is the most widely (seemingly universally)
supported mechanism available on HTML browsers.

window.onload = function(){
document.forms['frmLogon'].elements['userID'].focus();
};

Richard.
Jul 23 '05 #2

Richard:

Thanks for the info. I found this bit of code on this web site:
http://www.htmlhelp.com/faq/html/all.html

<script type='text/javascript'><!--
document.frmLog on.userID.focus ();
//--></script>

This seems to work in both of my environments and is closer to your
example than my original code. I'll try your example and see how it
goes.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12778
by: Put 030516 in email subj to get thru | last post by:
I've always been bothered about having to statically declare the size of a Java applet window (container?) in the calling HTML. I've always wanted the moral equivalent of width=50% statement (of the window or frame). I'm trying to use Javascript to do so. I can sort of get an example working in a Mozilla browser: > <!-- This works on...
1
2124
by: Blake Versiga | last post by:
How do i set the focus on a Textbox upon initial display of the page?
1
1281
by: Brian Henry | last post by:
I remember this from before but cant remember how to do it, its been over a year since i have... how do you set the initial focus to a text box on page load? isn't it a java script you have to do? thanks
4
1368
by: Gawel | last post by:
Hajo, from time to time I need to run "aspnet_regiis.exe -i" because javascript does not work. It is strange because it happens about twice per month. I have no idea what is going on. thanks in advance for any info gawel
1
3243
by: Mitch W | last post by:
I have an application that I have developed on Windows XP that references the Microsoft CDO for Windows 2000 and attempts to send a message using: CDO.Message cdoMsg = new CDO.Message(); It runs fins on my XP development system; however, when I move it to Windows 2003 Web Server with the IIS component SMTP installed I get a CDO.Interop...
1
1800
by: Steve2007 | last post by:
Hi I have the following form in my html page: <form name="mapserv" method=GET action=""> <input type="hidden" name="timeFiltering"> <input type="hidden" name="filteringType"> <input type="hidden" name="filteringBox"> <input type="hidden" name="Geofence" value="1|Geofence1|-88.19311|30.52311|-87.91011|30.65221|10|3"> <input type="hidden"...
6
3163
by: roop1 | last post by:
Hello gits, I found this snippet that you offered to another person and I was wondering if it wouldn't work for me as well: <script type="text/javascript"> function do_onload() { alert('hello'); } </script> <body onload="do_onload();">
1
2241
by: rameshch45 | last post by:
How to set the initial focus on the cursor in my form's first field? I dont want to use javascript for that as I have many forms - is there any attribute to set?
2
2442
by: davidson1 | last post by:
Hai friends..for menu to use in my website..i found in one website....pl look below website.... http://www.dynamicdrive.com/dynamicindex1/omnislide/index.htm i downloaded 2 files.... menuitems.js mmenu.js
0
7676
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. ...
0
7932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7442
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...
0
7776
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...
0
6001
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4965
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...
0
3473
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...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.