Solved

Javascript not working in firefox

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

743 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

10 Experts available now in Live!

Get 1:1 Help Now