" "没有定义 [英] " " is not defined
问题描述
任何人都可以告诉我这个错误吗?我偶尔会得到每一个
,这真的很痛苦。目前我和我一起工作的代码是这样的
< script>
<! -
var newwindow;
function moviepopup(url)
{
newwindow = window.open (url,''moviewindow'',''height = 28 0,width = 340,toolbar = no,menubar = no,locatio = no,statu s = yes,left = 435,top = 25'');
if(window.focus){newwindow.focus()}
}
function checkwindow()
{
if(!moviewindow.closed&& moviewindow.location){
moviepopup(url);
}
else
{
返回false;
}
}
- >
< / script>
进入< HEAD>
然后从这个身体多次调用它
< div align =" center">< font face =" Verdana,Arial,Helvetica,
sans-serif" size =" 1">< font color ="#993333">< strong> Sundance
/ Cabin< / strong>< br>
< a onClick =" checkwindow()"
target =" moviewindow"
href =" javascript :moviepopup( ''movies / 05-01.mov'');">< img
src =" images / movies / 05-01.gif" ALT =""名称= QUOT;"宽度= QUOT; 100" height =" 100"
border =" 0">< / a>< / font> < / font>< br>
< font color ="#993333" size =" 1"
face =" Verdana,Arial,Helvetica,sans-serif">点击播放< / 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>
现在,如果你不知道我想要的效果是什么,就像这样。
当你点击一张图片时,会出现一个大小的窗户,里面有一部电影
。它加载和播放。如果/当在
原始页面上点击另一部电影时,我希望第二部电影在moviewindow中重新加载。我建议你通过
电子邮件给javascrpt大师写一个checkwindow(),但很难和他保持对话。任何人都可以用这个来帮助我。谢谢
-Evan
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=window.open(url,''moviewindow'',''height=28 0,width=340,toolbar=no,menubar=no,locatio=no,statu s=yes,left=435,top=25'');
if (window.focus) {newwindow.focus()}
}
function checkwindow()
{
if (!moviewindow.closed && moviewindow.location) {
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>Sundance
/ Cabin</strong><br>
<a onClick="checkwindow()"
target="moviewindow"
href="javascript:moviepopup(''movies/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 "moviewindow" 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
推荐答案
Evan Sussman于2005年9月26日在comp中写道。 lang.javascript :
Evan Sussman wrote on 26 sep 2005 in comp.lang.javascript:
任何人都可以告诉我这个错误吗?我偶尔会得到它,这真的很痛苦。目前我正在使用的代码是这样的
< script>
缺少type =''text / javascript''
<! -
don''自2000年以来再使用它
var newwindow;
function moviepopup(url)
newwindow = window.open(url,''moviewindow '',''height = 28 0,width = 340,toolbar = n
o,menubar = no,locatio = no,status = yes,left = 435,top = 25'');
if(window.focus){newwindow.focus()}
有时新窗口在应用焦点时还没准备好。
为什么窗口没有重点,你刚刚点击它?
我想代码应该是[并测试]:
if( newwindow){newwindow.focus()}
}
函数checkwindow()
如果(!moviewindow.closed& ;& moviewindow.location){
moviepopup(url);
这里补充:
返回true
}
其他
其他不一定非必要
{
返回false;
}
}
- >
如上所述
< / script>
进入< HEAD>
然后它从身体多次被称为
< div align =" center">< font face =" Verdana,Arial,Helvetica,
sans-serif" size =" 1">< font color ="#993333">< strong> Sundance
/ Cabin< / strong>< br>
请不要向我们展示不必要的代码,它会分散注意力。
< a onClick =" checkwindow()"
target =" ; moviewindow"
此目标声明永远不会被您的javascript使用,跳过它。
href =" javascript :moviepopup(''电影/ 05-01.mov '');">
onclick需要退货:
onClick =" return checkwindow()"
但我宁愿不使用href =" javascript :..试试:
< a onClick =" if(checkwindow())moviepopup(''movies / 05-01.mov'');"
href =''#''>
>
或者更好,将moviepopup()移动到checkwindow()函数中
< img src =" images / movies / 05-01.gif" ALT =""名称= QUOT;"宽度= QUOT; 100" height =" 100"
border =" 0">< / a>< / font> < / font>< br>
< font color ="#993333" size =" 1"
face =" Verdana,Arial,Helvetica,sans-serif">点击播放< / 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>
跳过大部分内容向我们展示。
从这里开始
[..]
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=window.open(url,''moviewindow'',''height=28 0,width=340,toolbar=n
o,menubar=no,locatio=no,status=yes,left=435,top=25 '');
if (window.focus) {newwindow.focus()}
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.focus()}
}
function checkwindow()
{
if (!moviewindow.closed && moviewindow.location) {
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>Sundance
/ Cabin</strong><br>
Please do not show us unnecessary code, it distracts.
<a onClick="checkwindow()"
target="moviewindow"
This target declaration is never used by your javascript, skip it.
href="javascript:moviepopup(''movies/05-01.mov'');">
The onclick needs a return:
onClick="return checkwindow()"
but I would prefer not to use the href="javascript:.. at all, try:
<a onClick="if (checkwindow())moviepopup(''movies/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。
荷兰。
(用我的电子邮件地址替换所有带点的十字架)
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
谢谢,会尝试。
thanks, will try.
好的,当我改变
ok, when I changed
< a onClick =" checkwindow()" target =" moviewindow"
href =" javascript :moviepopup(''movies / 05-01.mov'');">
to
< a onClick =" if(checkwindow())moviepopup(''movies / 05-01.mov'');" ; > HREF ="的JavaScript的 的:moviepopup(电影/ 05-01.mov);">
它有效,但仍然返回moviewindow未定义在线
然后我尝试了用
href ="#"
<a onClick="checkwindow()" target="moviewindow"
href="javascript:moviepopup(''movies/05-01.mov'');">
to
<a onClick="if (checkwindow())moviepopup(''movies/05-01.mov'');" >href="javascript:moviepopup(''movies/05-01.mov'');">
It worked, but it still returned "moviewindow is not defined" on line
31
then I tried it with
href="#"
并且它不会加载,仍然返回电影未定义在第31行
所以不知何故,javascript的jref仍然需要在脚本中扮演一个部分
。任何人都有任何建议。谢谢Evertjan,你的
最后的帖子非常有帮助。
-Evan
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
这篇关于" "没有定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!