Solved

Javascript not working in firefox

Posted on 2004-09-22
5
3,528 Views
Last Modified: 2013-11-19
I get the following errors and warnings in the Firefox JavaScript console:

Warning: Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
Source File: http://www.verityservice.com/vts/datePicker.aspx?fn=form1&tn=startDateTB
Line: 275

Error: window.opener.form1 has no properties
Source File: http://www.verityservice.com/vts/datePicker.aspx?fn=form1&tn=startDateTB
Line: 277

The javascript is:

<script language="javascript">
          function CalendarScript()
          {                    
               setTimeout(window.close,30000)
               if (!(Form1.txtDate.value==""))
                {
                    window.opener.form1.startDateTB.value=Form1.txtDate.value;
                    window.close()
               }          
          }
          </script>

What I have going on is I have a link on aspx that opens up a calender, a date is selected, the calender closes and the a textbox is poplulated with the date chosen.  This works in IE but will not work when viewed by Mozilla Firefox.
0
Comment
Question by:healco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 50 total points
ID: 12127633
Hi healco,

Do this:

<script language="javascript">
<!--

function CalendarScript() {
   setTimeout('window.close()',30000);
   if (!(document.forms['Form1'].txtDate.value=="")) {
      if (window.opener&&!window.opener.closed) {
         window.opener.forms['form1'].startDateTB.value=document.forms['Form1'].txtDate.value;
         window.close();
      }
   }
}

//-->
</script>


The two window.close are a bit contradictory, but if you want it that way...

Regards,
Zyloch
0
 

Expert Comment

by:W3bmistress
ID: 12955397
where do you add the resolution?
0
 

Expert Comment

by:EnigmaSupport
ID: 14737787
For FIREFOX you need to FULLY REFERENCE the document object model....


THESE DON'T WORK:
opener.formname.fieldname.value="";
window.opener.formname.fieldname.value="";

THIS DOES WORK:
window.opener.document.formname.fieldname.value="";
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question