473,606 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

" " is not defined

Could any one give me an explenation of this error? I get it every
once in a while, and it really is a pain. currently the code that I'm
working with goes like this

<script>
<!--
var newwindow;
function moviepopup(url)
{

newwindow=windo w.open(url,'mov iewindow','heig ht=280,width=34 0,toolbar=no,me nubar=no,locati o=no,status=yes ,left=435,top=2 5');
if (window.focus) {newwindow.focu s()}
}

function checkwindow()
{
if (!moviewindow.c losed && moviewindow.loc ation) {
moviepopup(url) ;
}
else
{
return false;
}
}
-->
</script>

that goes in the <HEAD>
and then it is called multiple times from the body like this

<div align="center"> <font face="Verdana, Arial, Helvetica,
sans-serif" size="1"><font color="#993333" ><strong>Sundan ce
/ Cabin</strong><br>
<a onClick="checkw indow()"
target="moviewi ndow"
href="javascrip t:moviepopup('m ovies/05-01.mov');"><img
src="images/movies/05-01.gif" alt="" name="" width="100" height="100"
border="0"></a></font> </font><br>
<font color="#993333" size="1"
face="Verdana, Arial, Helvetica, sans-serif">Click to Play</font><br>
<font face="Verdana, Arial, Helvetica,
sans-serif" size="1"><font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><font color="#993333" > </font></font></font></div>

Now, if you can't tell what the effect I'm going for, its like this.
When you click on a picture, a sized windows appears with a movie
inside it. it loads and plays. If/When another movie is clicked on the
original page, I want the second movie to reload in the "moviewindo w" I
was advised to write checkwindow() by a javascrpt guru through the
email, but it is hard to keep a conversation with him. can anyone help
me with this. thanks

-Evan

Sep 26 '05 #1
21 3337
Evan Sussman wrote on 26 sep 2005 in comp.lang.javas cript:
Could any one give me an explenation of this error? I get it every
once in a while, and it really is a pain. currently the code that I'm
working with goes like this

<script>
missing type='text/javascript'
<!--
don't use this anymore since 2000
var newwindow;
function moviepopup(url)
{

newwindow=windo w.open(url,'mov iewindow','heig ht=280,width=34 0,toolbar=n
o,menubar=no,lo catio=no,status =yes,left=435,t op=25');
if (window.focus) {newwindow.focu s()}
perhaps sometimes the newwindow is not ready when applying the focus.
why should window not have the focus, as you just clicked in it?

I suppose the code should be [and be testing for that]:

if (newwindow) {newwindow.focu s()}

}

function checkwindow()
{
if (!moviewindow.c losed && moviewindow.loc ation) {
moviepopup(url) ;
Here add:

return true
}
else
else not realy necessary
{
return false;
}
}
-->
as above
</script>

that goes in the <HEAD>
and then it is called multiple times from the body like this

<div align="center"> <font face="Verdana, Arial, Helvetica,
sans-serif" size="1"><font color="#993333" ><strong>Sundan ce
/ Cabin</strong><br>
Please do not show us unnecessary code, it distracts.
<a onClick="checkw indow()"
target="moviewi ndow"
This target declaration is never used by your javascript, skip it.
href="javascrip t:moviepopup('m ovies/05-01.mov');">

The onclick needs a return:

onClick="return checkwindow()"

but I would prefer not to use the href="javascrip t:.. at all, try:

<a onClick="if (checkwindow()) moviepopup('mov ies/05-01.mov');"
href='#'>

Or still better, move the moviepopup() into the checkwindow() function

<img src="images/movies/05-01.gif" alt="" name="" width="100" height="100"
border="0"></a></font> </font><br>
<font color="#993333" size="1"
face="Verdana, Arial, Helvetica, sans-serif">Click to Play</font><br>
<font face="Verdana, Arial, Helvetica,
sans-serif" size="1"><font face="Verdana, Arial, Helvetica,
sans-serif" size="1"><font color="#993333" >
</font></font></font></div>
skip most of this showing it to us.
Go from here
[..]


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 26 '05 #2
thanks, will try.

Sep 26 '05 #3
ok, when I changed
<a onClick="checkw indow()" target="moviewi ndow"
href="javascrip t:moviepopup('m ovies/05-01.mov');">
to
<a onClick="if (checkwindow()) moviepopup('mov ies/05-01.mov');" >href="javascri pt:moviepopup(' movies/05-01.mov');">
It worked, but it still returned "moviewindo w is not defined" on line
31

then I tried it with
href="#"


and it wouldn't load, still returned "movie is not defined" on line 31

so somehow, the href to the javascript is still needing to play a part
in the script. anyone have any suggestions. thanks Evertjan, as your
last post was very helpful.

-Evan

Sep 26 '05 #4
when I remove the href altogether, it still gives the same error as the
href="#" I guess that was a stupid attempt.
lol

-evan
still testing

Sep 26 '05 #5
Evan Sussman wrote:
ok, when I changed

<a onClick="checkw indow()" target="moviewi ndow"
href="javascr ipt:moviepopup( 'movies/05-01.mov');">

to

<a onClick="if (checkwindow()) moviepopup('mov ies/05-01.mov');" >href="javascri pt:moviepopup(' movies/05-01.mov');">

It worked, but it still returned "moviewindo w is not defined" on line
31


And it isn't!

You assign window.open's result to newwindow and have newwindow as a
global variable. You should therefore use:
if (!newwindow.clo sed && newwindow.locat ion) {
moviepopup(url) ;
}

There is probably another way to get to the moviewindow object (as you
assigned it that name), but not the way you're doing it.

Cheers,
Andy
Sep 26 '05 #6
now, after trying what you said Andy, it reloads the original window,
and gives the error "newwindow has no propertys" at line 31

Sep 26 '05 #7
Evan Sussman wrote:
now, after trying what you said Andy, it reloads the original window,
and gives the error "newwindow has no propertys" at line 31


Is the page available online anywhere?

Anyway, try changing it to:

if (newwindow && !newwindow.clos ed && newwindow.locat ion) {
moviepopup(url) ;
}

This should check to see if newwindow is set.

Cheers,
Andy
Sep 26 '05 #8
yeah, go to http://www.whitmoreacademy.com/movies.php
you will have to login with
UN=admin
PW=chilcotin

Sep 26 '05 #9
after changing that, all it does is reload this time no errors. I guess
we're making progress, well now we can't target an error. Now we gotta
get the window to open, and the original window not to reload.

Sep 26 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
13100
by: bill | last post by:
Forget the exact definition of difference between, #include <foo.h> and #include "bar.h" Normally foo.h is a standard header file, so it's path is not defined in compiler option, but I am curious how compiler find it.
8
3367
by: TTroy | last post by:
I have a few questions about "scope" and "visibility," which seem like two different things. To me "visibility" of the name of a function or object is the actual code that can use it in an actual program. To me "scope" of the name of a function or object are the general rules for the areas of a program that can through a declaration, have "visibility."
188
17302
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
49
14466
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On http://www.webreference.com/programming/javascript/gr/column9/ they say: <snip> The undefined property A relatively recent addition to JavaScript is the undefined property.
3
12002
by: nan | last post by:
Hi All, I am trying to connect the Database which is installed in AS400 using DB2 Client Version 8 in Windows box. First i created the Catalog, then when i selected the connection type as ODBC, then i am getting
43
2703
by: markryde | last post by:
Hello, I saw in some open source projects a use of "!!" in "C" code; for example: in some header file #define event_pending(v) \ (!!(v)->vcpu_info->evtchn_upcall_pending & \ !(v)->vcpu_info->evtchn_upcall_mask) whereas evtchn_upcall_pending is of type unsigned char (and also evtchn_upcall_mask is of type unsigned char).
9
10712
by: Klaus Johannes Rusch | last post by:
IE7 returns "unknown" instead of "undefined" when querying the type of an unknown property of an object, for example document.write(typeof window.missingproperty); Has "unknown" been defined as a valid return value for the typeof operator in a later version of ECMAScript or is this a JScript "feature"? -- Klaus Johannes Rusch
3
1696
by: albert.neu | last post by:
Hello! What is the difference between "library parts" of C99 and "language parts" of C99. see http://groups.google.at/group/microsoft.public.vc.language/browse_thread/thread/e9a67f0ff20a954b/bd2bada2bbdbce56?lnk=st&rnum=1#bd2bada2bbdbce56 I know that "Dinkum Compleat Libraries" (http://www.dinkumware.com/) support the "library parts" of C99 - this probably relates to the C99
30
4664
by: kj | last post by:
My book (Flanagan's JavaScript: The Definitive Guide, 5th ed.) implies on page 111 that the following two constructs are equivalent: ( x.constructor == Foo ) and ( x instanceof Foo ) The author states that the instanceof operator computes its result
4
9843
by: FullBandwidth | last post by:
I have been perusing various blogs and MSDN pages discussing the use of event properties and the EventHandlerList class. I don't believe there's anything special about the EventHandlerList class in this context, in fact some articles from pre-2.0 suggest using any collection class of your choice. So my questions focus more on the syntax of event properties provided by the "event" keyword in C#. (Disclaimer - I am a C++ programmer working...
0
8009
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7939
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8428
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8299
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5962
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5456
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3919
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3964
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1548
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.