On Wed, 22 Dec 2004 11:59:06 -0000, James Leech
<ja***@graphics-line.co.uk> wrote:
[snip]
I have added a standard DW behaviour (function to non-DW peeps)
All the code I've seen generated by DW is, quite frankly, crap. The code
you've posted is no exception.
that simply redirects the user to another page
Javascript should never be used for navigation, but as you're authoring
for an intranet, you can probably get away with it.
and is fired when a user hits a button,
Any reason why you can't just use a link? You're obviously going to have
much better luck using standard functionality.
[snip]
<script language="JavaScript" type="text/JavaScript">
[Unrelated] The language attribute is deprecated (has been for over six
years) and redundant when the (required) type attribute is present.
<!--
[Unrelated] Hiding scripts is also an out-dated practice.
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments;
document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2)
eval(args[i]+".location='"+args[i+1]+"'");
It's possible that the eval function is unimplemented. ECMA-327, which
defines a subset of ECMAScript, allows implementations to omit a few
features to reduce load on the environment. However, as I don't have
access to PocketIE I couldn't say for certain.
If you're just altering the URL for the current document, you could
simplify the function to
function goToURL(url) {location.href = url;}
If you're using frames (and you generally shouldn't):
function goToURL(url, frame) {
(frame || window).location.href = url;
}
If the frame argument is omitted, the current document will be altered.
If you really need the functionality provided by DW's original function:
function goToURL() {
for(var i = 0, n = arguments.length; i < n; i += 2) {
arguments[i].location.href = arguments[i + 1];
}
}
As you can see, eval is entirely unnecessary. The author's just clueless.
Hope that helps,
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.