Solved

Javascript not working in firefox

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

SuperAntiSpyware Licenses Discounted by 25% !

Exclusive offer to Experts Exchange Members!
Buy SuperAntiSpyware License(s) from us and save 25% on the regular purchase price.
- Includes Full SuperAntiSpyware Vendor Support Entitlements
- Your Subscription does not begin until you activate your license
- Buy for your friends

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
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…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

738 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