Connecting Tech Pros Worldwide Help | Site Map

netscape vs ie

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 11:59 AM
Terry A. Haimann
Guest
 
Posts: n/a
Default netscape vs ie

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");
}

  #2  
Old July 20th, 2005, 11:59 AM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default 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.'
  #3  
Old July 20th, 2005, 12:00 PM
Michael Winter
Guest
 
Posts: n/a
Default 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)
  #4  
Old July 20th, 2005, 12:01 PM
Terry A. Haimann
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.