Solved

Javascript not working in firefox

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

932 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now