The said:
Someone gave me this and I want to know if there is a better way. It
works fine in IE but in Firefox the link is way to the left:
.nextimg {
position: relative;
margin: 20px 0 20px 40px;
padding: 5px 0; width: 300px;
height: 36px;
background-image: url(./images/spacer.gif);
background-repeat: no-repeat;
}
#nextlink {
position: absolute;
top: 555px;
left: 525px;
width: 145px;
height: 36px;
background-color: transparent;
border: 0;
}
<div class="nextimg">
<a id="nextlink" href="page2.php" onclick="if ('preventDefault'
in event) { event.preventDefault(); } else { event.returnValue =
false; } validate(document.forms['page1']);"></a>
</div>
There is a better way because this one does not work reliably to begin with:
the `a' element should not be empty (it should at least contain ` '),
`in' should not be used with host objects, and the whole
preventDefault/returnValue nonsense is not even necessary (one can return
`false' and be done with it). It is safe to say that whoever gave you this
code (provided there was such a person and we are not looking at a FOAF
phenomenon or worse here) does not know what they are doing.
In any case, the relevance of this to JS/ES programming ranges very close to
zero. Besides a programming exercise, which would be your task to solve for
yourself (that would be the very purpose of the exercise), I cannot think of
any pertinent application. IMHO, it reads much more like an attempt in
trying to trick your users, perhaps a misguided attempt to submit
information without the user knowing about it, which is a suspicion hardened
by your posting anonymously using Google Groups, failing to respond to the
questions you have been asked, and failing to show any initiative in the
process (though I might be wrong.)
It would probably be best if you said what you really want to achieve and
why, so that you can be presented with pertinent approaches to choose from,
instead of our wasting our time trying to solve your problems with your
current approach (which apparently was suggested by a person not knowing
what they are doing, perhaps in part without being guilty for that) while
guessing around why on Earth you would want to do such a thing.
And trim your quotes.
<
http://jibbering.com/faq/#posting>
PointedEars