Solved

Javascript not working in firefox

Posted on 2004-09-22
5
3,518 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

786 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