Connecting Tech Pros Worldwide Forums | Help | Site Map

netscape vs ie

Terry A. Haimann
Guest
 
Posts: n/a
#1: Jul 20 '05
I have the following function that works under netscape 7, but doesn't
work under ie. What changes should be made to make it run under ie?

function ButFunction()
{
var Page;
var s;
var d;
var h, w;

s = document.SrchForm.SearchDB.value;
d = document.SrchForm.DetailDB.value;
d = d - 1;

Page = "Table_Page.html?" + "sch=" +
document.SrchForm.SearchDB.options[s].text + "&" +
"dtl=" + document.SrchForm.DetailDB.options[d].text;
var newWindow = open(Page, "Records Selected", "fullscreen=yes");
}

Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#2: Jul 20 '05

re: netscape vs ie


"Terry A. Haimann" <terry@yngstr.oldboy.com> writes:
[color=blue]
> I have the following function that works under netscape 7, but doesn't
> work under ie. What changes should be made to make it run under ie?[/color]

There are three things that you need to tell when you ask for help
with code that doesn't work:

1) What did you do? The code is a beginning, but how is it called?
What is on the page? What browser are you using (you said this one)?
2) What did you expect to happen? I.e., what was your intention. It
is hard to tell you what to change if we don't know the goal.
3) What really happened? "Didn't work" is not sufficient. We know
that, otherwise you wouldn't ask. Error messages, or their absence,
and any visible effect, or absence of it.
[color=blue]
> function ButFunction()
> {
> var Page;
> var s;
> var d;
> var h, w;
>
> s = document.SrchForm.SearchDB.value;[/color]

I prefer
s = document.forms['SrchForm'].elements['SearchDB'].value;
However, if it works in Mozilla/Netscape without these collections,
then it probably also works in IE.
[color=blue]
> var newWindow = open(Page, "Records Selected", "fullscreen=yes");[/color]

Most likely error: Window names are not allowed to contain spaces.

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Michael Winter
Guest
 
Posts: n/a
#3: Jul 20 '05

re: netscape vs ie


Terry A. Haimann wrote on 19 Nov 2003:
[color=blue]
> I have the following function that works under netscape 7, but
> doesn't work under ie. What changes should be made to make it
> run under ie?
>
> function ButFunction()
> {
> var Page;
> var s;
> var d;
> var h, w;
>
> s = document.SrchForm.SearchDB.value;
> d = document.SrchForm.DetailDB.value;
> d = d - 1;[/color]

What exactly are you trying to do here? The Select.options array
expects an numerical index, so unless the value of each option in the
select menu is its own index, your code below shouldn't work. If the
option values do contain their index, you've picked an awkward way of
doing things. This would probably be better:

var s = document.forms['SrchForm'].SearchDB.selectedIndex;
var d = document.forms['SrchForm'].DetailDB.selectedIndex--;

There's also no need for the separate decrement, and the values could
be a little more meaningful (if appropriate).

Note: Select.selectedIndex will return zero-based indexes, so using
the above means that the first option in the DetailDB menu cannot be
selected. In that case, 'd' would be -1 and that's out of range for
the Select.options array.
[color=blue]
> Page = "Table_Page.html?" + "sch=" +
> document.SrchForm.SearchDB.options[s].text + "&" +
> "dtl=" + document.SrchForm.DetailDB.options[d].text;
> var newWindow = open(Page, "Records Selected", "fullscreen=yes");[/color]

'fullscreen' is not a valid feature for a window (not by my
references, anyway), and it has been said in this group many times
now that trying to manipulate the user's browser dimensions is a bad
idea.

'Records Selected' is invalid. Remove the space or replace it with an
underscore. A window name is the same as a frame name and must begin
with a letter, and only contain letters, digits, hyphens (-),
underscores (_), periods (.), and colons (:). However, if you refer
to a name that contains anything other than alphanumeric characters,
you should use the appropriate collection and "quote" the name (like
I did earlier, using document.forms).

You should also use window.open(...) to make the call to
window.open() less ambiguous, and to avoid accidentally calling
document.open().

Hope that helps,

Mike

--
Michael Winter
M.Winter@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Terry A. Haimann
Guest
 
Posts: n/a
#4: Jul 20 '05

re: netscape vs ie


On Thu, 20 Nov 2003 00:39:43 +0100, Lasse Reichstein Nielsen wrote:
[color=blue]
> Most likely error: Window names are not allowed to contain spaces.[/color]

Yes that was the problem, Thx
Closed Thread


Similar JavaScript / Ajax / DHTML bytes