在Mozilla / Firefox中没有定义setPage错误 [英] setPage is not defined error in Mozilla/Firefox

查看:84
本文介绍了在Mozilla / Firefox中没有定义setPage错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我一直在处理下面这段代码,它在IE浏览器中运行良好

和Opera,dut继续得到Firefox中的错误相同。任何人都可以告诉我这个代码有什么问题吗?我要做的是重写

左(导航框)并在右边(主机)加载页面。


tia,

Johan


这是一段代码:


函数setHome(pageCode){

with(document){

open();

write(''<?xml version =" 1.0" encoding =" iso- 8859-1"?> \ n<!DOCTYPE html

PUBLIC" - // W3C // DTD XHTML 1.0 Transitional // EN"

" http ://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> \ n'');

write(''\ n< html xmlns =" ; http://www.w3.org/1999/xhtml"> \ n\ n'');

写(''< head> \\\
< link rel = " stylesheet" type =" text / css"

href =" ./ nav.css" /> \\\
< script src =" ./ nav.js" type = " text / javascript"

language =" JavaScript"> \ n< / script> \ n&l t; / head> \ n\ n'');

写(''< body> \ n'');

写('' < div id =" navigation"> \ n'');

write(''< table> \ n'');

写(''< tr> \ n< td>< a href ="#" onclick =" setHome(\''。/ homemain.html \'')"

class =" current"> Home< / a>< / td> \ n< / tr>'');

写(''< tr> \ n< td>< a href ="#"

onclick =" setSoftware(\''。/ software.html \'')">软件< / a>< / td> \ n< / tr>'');

写(''< tr> \ n< td>< a href ="#"

onclick =" setLinks(\''linksmain.html \' ')">链接< / a>< / td> \ n< / tr>'');

写(''< tr> \ n< td>< ; a href ="#"

onclick =" setInfo(\''。/ informatie.html \'')"> Informatie< / a>< / td> ; \ n< / tr>'');

写(''< / table>'');

write(''< / div> '');

写(''< / body>'');

写(''< / html>'');

C lost();

setPage(pageCode);

}

}


... 。


函数setPage(url){

parent.mainframe.location.href = url.toString();

}

Hi,

I''ve been working on the following piece of code and it works fine in IE
and Opera, dut keep getting the same error in Firefox. Can anyone tell
me what''s wrong with this code? What I''m trying to do is rewrite the
left (navigationframe) and load a page on the right (mainframe).

tia,
Johan

Here''s a piece of the code:

function setHome(pageCode) {
with (document) {
open();
write(''<?xml version="1.0" encoding="iso-8859-1"?>\n<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n'');
write(''\n<html xmlns="http://www.w3.org/1999/xhtml">\n\n'');
write(''<head>\n<link rel="stylesheet" type="text/css"
href="./nav.css" />\n<script src="./nav.js" type="text/javascript"
language="JavaScript">\n</script>\n</head>\n\n'');
write(''<body>\n'');
write(''<div id="navigation">\n'');
write(''<table>\n'');
write(''<tr>\n<td><a href="#" onclick="setHome(\''./homemain.html\'')"
class="current">Home</a></td>\n</tr>'');
write(''<tr>\n<td><a href="#"
onclick="setSoftware(\''./software.html\'')">Software</a></td>\n</tr>'');
write(''<tr>\n<td><a href="#"
onclick="setLinks(\''linksmain.html\'')">Links</a></td>\n</tr>'');
write(''<tr>\n<td><a href="#"
onclick="setInfo(\''./informatie.html\'')">Informatie</a></td>\n</tr>'');
write(''</table>'');
write(''</div>'');
write(''</body>'');
write(''</html>'');
close();
setPage(pageCode);
}
}

....

function setPage(url) {
parent.mainframe.location.href = url.toString();
}

推荐答案

2004年9月7日星期二22:18:16 +0200,Johan写道:
On Tue, 07 Sep 2004 22:18:16 +0200, Johan wrote:
我一直在研究下面这段代码,它在IE浏览器和Opera中工作得很好,但是在Firefox中一直没有得到同样的错误。


所以,让我猜一下......那可能是''Fluffy_kittens

未定义的错误'?在这种情况下,

改变第43行,将char 19从''。'改为'';''。


不好?


提交它可能更有效率

陈述*具体*你有什么错误

正在获得。

这是一段代码:
I''ve been working on the following piece of code and it works fine in IE
and Opera, dut keep getting the same error in Firefox.
So, let me guess.. That''s a ''Fluffy_kittens
not defined error'' perhaps? In that case,
change line 43, char 19 from a ''.'' to a '';''.

No good?

Filing that it might be more productive
to state *specifically* what error you
are getting.
Here''s a piece of the code:




Aaahh是的。 ''一段代码''..


如果它坏了,你不知道

如何解决它,是什么让你想想吧

这部分代码是否被破坏了?


< http://www.physci.org/codes/sscce.jsp>


-

Andrew Thompson
http://www.PhySci.org/ 开源软件套件
http://www.PhySci.org/codes/ Web& IT帮助
http://www.1point1C.org/ Science&技术



Aaahh yes. ''a piece of the code''..

If it it is broken, and you do not know
how to fix it, what makes you think it
is this part of the code that is broken?

<http://www.physci.org/codes/sscce.jsp>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology


文章< 41 ********************* @ reader10.nntp.hccnet.nl >,Johan

< jo ********* @ ilseDOT.nl>写道:
In article <41*********************@reader10.nntp.hccnet.nl >, Johan
<jo*********@ilseDOT.nl> wrote:
这是一段代码:

函数setHome(pageCode){
with(document){
打开();
< snip> close();
setPage(pageCode);
}
}



函数setPage(url){
parent.mainframe.location.href = url.toString();
}
Here''s a piece of the code:

function setHome(pageCode) {
with (document) {
open(); <snip> close();
setPage(pageCode);
}
}

...

function setPage(url) {
parent.mainframe.location.href = url.toString();
}




我不是真正的JS大师,但如果它'就像其他语言一样,你必须在*之前定义函数*才能调用/使用它们。你的代码在setHome()函数中调用了

setPage(),但是setPage()没有定义

直到代码后面 - 我很惊讶它在任何浏览器。



I''m no real JS guru, but if it''s like other languages, then you have to
define functions *before* you can call/use them. Your code calls
setPage() inside the setHome() function, but setPage() is not defined
until later in the code - I''m surprised it works in any browser.


2004年9月7日星期二22:18:16 +0200,Johan< jo ********* @ ilseDOT.nl>写道:
On Tue, 07 Sep 2004 22:18:16 +0200, Johan <jo*********@ilseDOT.nl> wrote:
我一直在研究下面这段代码,它在IE浏览器和Opera中运行良好,但在Firefox中一直没有得到同样的错误。任何人都可以告诉我这个代码有什么问题吗?我要做的是重写
左(导航框架)并在右边(主机)加载页面。
I''ve been working on the following piece of code and it works fine in IE
and Opera, dut keep getting the same error in Firefox. Can anyone tell
me what''s wrong with this code? What I''m trying to do is rewrite the
left (navigationframe) and load a page on the right (mainframe).




[snipped code]


你能提供一个URL吗?我没有看到任何错误(虽然我可能会错过

错过了什么)。一个工作示例可以更容易地看到

问题。


我想在完成之前提几点:


- 你应该确保你逃脱"< /"序列成< \ /。这是

,因为允许浏览器处理< /作为SCRIPT

元素的结尾。

- HTML文档中需要TITLE元素。即使你离开它

空[1],


< title>< / title>


总是包含它。

- 您可以使用writeln方法结束带有换行符号
字符的书写行。

- The SCRIPT元素中的language属性已被弃用,有利于

(必需)类型属性。你不需要再使用前者了。

- 由于你写入框架的内容是静态的,为什么不加载一个

的HTML文件呢?


迈克


[1]没有理由把它留空。你总会得到一些页面的

标签。


-

Michael Winter

替换.invalid与.uk通过电子邮件回复。



[snipped code]

Could you provide a URL? I don''t see anything wrong (though I might have
missed something). A working example would make it much easier to see the
problem.

I would like to mention a few points before I finish:

- You should make sure you escape "</" sequences into "<\/". This is
because browsers are allowed to treat "</" as the end of the SCRIPT
element.
- The TITLE element is required in a HTML document. Even if you leave it
empty[1],

<title></title>

always include it.
- You can use the writeln method to end a written line with a new-line
character.
- The language attribute in a SCRIPT element has been deprecated in favour
of the (required) type attribute. You needn''t use the former any more.
- As the content you''re writing into the frame is static, why not load a
HTML file instead?

Mike

[1] There''s no real reason to leave it empty. You''ll always have some form
of label for a page.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.


这篇关于在Mozilla / Firefox中没有定义setPage错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆