Re: FireFox and IE respond differently to my site.

Re: FireFox and IE respond differently to my site.

am 06.11.2007 04:53:31 von zalek

On Nov 5, 10:09 pm, RobG wrote:
> On Nov 6, 12:22 pm, zalek wrote:
>
> > Here is my site:http://www.geocities.com/zalekbloom/a2.html
>
> The rubbished added by your host inserts scripts that cause errors in
> Firefox, and they make your page invalid HTML.
>
> > When I open this site with FireFox - Select fields "Date from (yyyyy/
> > mm/dd)" and "Date to (yyyyy/mm/dd)" are not initialized, but they are
> > initialized when I open this site with IE.
>
> > The code that is not working in FireFox but working in IE is:
>
> > var option0 = new Option(curr_year,curr_year) ;
> > document.form1.f_from_yyyy.add(option0) ;
>
> You are mixing DOM 0 (new Option) and DOM 1 (add method) and Firefox
> doesn't like it. Instead, use just DOM 0 (wrapped for posting):
>
> var sel = document.form1.f_from_yyyy;
> if (sel) {
> sel.options[sel.options.length] =
> new Option(curr_year, curr_year);
> }
>
> --
> Rob

Thanks Rob,

It worked!

Now another question - I want to display a date on a page.
I used command:

document.write(....)

but after I put this code in function that starts "onLoad" - this code
is not working.
So how to display a date, or other string built by a function?

Thanks,

Zalek

Re: FireFox and IE respond differently to my site.

am 06.11.2007 06:01:20 von Randy Webb

zalek said the following on 11/5/2007 10:53 PM:
> On Nov 5, 10:09 pm, RobG wrote:
>> On Nov 6, 12:22 pm, zalek wrote:
>>
>>> Here is my site:http://www.geocities.com/zalekbloom/a2.html
>> The rubbished added by your host inserts scripts that cause errors in
>> Firefox, and they make your page invalid HTML.
>>
>>> When I open this site with FireFox - Select fields "Date from (yyyyy/
>>> mm/dd)" and "Date to (yyyyy/mm/dd)" are not initialized, but they are
>>> initialized when I open this site with IE.
>>> The code that is not working in FireFox but working in IE is:
>>> var option0 = new Option(curr_year,curr_year) ;
>>> document.form1.f_from_yyyy.add(option0) ;
>> You are mixing DOM 0 (new Option) and DOM 1 (add method) and Firefox
>> doesn't like it. Instead, use just DOM 0 (wrapped for posting):
>>
>> var sel = document.form1.f_from_yyyy;
>> if (sel) {
>> sel.options[sel.options.length] =
>> new Option(curr_year, curr_year);
>> }
>>
>> --
>> Rob
>
> Thanks Rob,
>
> It worked!
>
> Now another question - I want to display a date on a page.
> I used command:
>
> document.write(....)
>
> but after I put this code in function that starts "onLoad" - this code
> is not working.
> So how to display a date, or other string built by a function?

You use something like DynWrite that is in the group FAQ. If you use
document.write after the page has loaded then it replaces the current
page with a new one.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/