[thelist] NS6 DOM gurus... this way please!

Alister Cameron alister at cameron.org
Thu Mar 1 19:45:34 CST 2001


Friends,

I can't get this code (which works great in IE5) to work in NS6.

I know it's not far from happening but I think I may need proper NS6 event
listeners and all that and sadly I just don't get that stuff yet.

Can an NS6 DOM guru give me some clues or better still rewrite this for NS6?

By the way. The code/idea I originally found at www.webos.com and have been
fiddling with it for a while since. It bolds the title field of a given form
input field when you click into that field. Nice on-the-fly CSS updating and
I would think not too hard to implement in NS6.

Many thanks. Hope the code makes sense. I simplified it as much as I could.

Alister Cameron

-------------------------------------------------

<html>
<head>
	<title>Funky forms code</title>
	<style type="text/css">
		.stdText {font: normal 9pt Verdana;}
	</style>
	<script language="JavaScript" type="text/javascript">
		var formFields,i
		formFields = new Array("username","password","rememberme")
		function boldTitle(){eval(this.name+'_title').style.fontWeight='bold'}
		function normalTitle(){eval(this.name+'_title').style.fontWeight='normal'}
		function init(){
			for(i=0;i<formFields.length;i++){
				eval("document.getElementById('"+formFields[i]+"').onfocus=boldTitle")
				eval("document.getElementById('"+formFields[i]+"').onblur=normalTitle")
			}
			document.getElementById(formFields[0]).focus()
		}
	</script>
</head>
<body onload="init();">
<table><form id="loginForm" name="loginForm" method="post"
action="javascript:alert('form submitted')">
	<tr>
		<td class="stdText"><span
id="username_title">Username</span>&nbsp;&nbsp;</td>
		<td><input type="text" name="username" value="" size="14"
tabindex="1"></td>
		<td rowspan="3"><input type="submit" value="submit"></td>
	</tr>
	<tr>
		<td class="stdText"><span
id="password_title">Password</span>&nbsp;&nbsp;</td>
		<td><input type="password" name="password" size="14" tabindex="2"></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td class="stdText"><input type="checkbox" name="rememberme" checked
tabindex="3" value="rememberme"> <span id="rememberme_title">Remember
me</span></td>
	</tr>
</form></table>
</body>
</html>





More information about the thelist mailing list