我在这做错了什么。简单陈述。新手问题。 [英] What am I doing wrong here. Simple statement. Novice Question.

查看:50
本文介绍了我在这做错了什么。简单陈述。新手问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI!我的代码出错了。


< SCRIPT language =" JavaScript">

if(ifp ==""){

ifp =" default.htm"}

// - >< / SCRIPT>


基本上我如果用户直接输入

,我希望我的iframe有一个默认页面。所以我需要这样做。所以我检查ifp值是否为
null,如果是,则为其赋值。这是正确的吗?

提前谢谢:)


Paul

解决方案

"保罗" < PA *********** @ sympatico.ca>在消息中写道

news:uL ******************* @ news20.bellglobal.com ..。

HI!我的代码出错了。

< SCRIPT language =" JavaScript">
If ifp ==""){
ifp =" default.htm"}
// - >< / SCRIPT>

基本上,如果用户直接输入
,我希望我的iframe有一个默认页面。所以我需要这样做。所以我检查ifp值是否为
null,如果是,则为其赋值。这是正确的吗?

提前谢谢:)

保罗



因为你没有说错误我可能错了但是,正如我所料,它是对象

预期那是因为你有一个资本我在如果中这应该是

小写:


if(ifp =="")

{

ifp =" default.htm";

}


一般来说,所有JavaScript关键字都以小写字母开头,内置

对象,例如String是一个这样的例外,通常如果两个或多个

单词连接在一起,除了第一个单词的首字母大写,例如
toLowerCase。一个例外是运算符,例如typeof。

-

作为一个侧面点,尽管在这个例子中语法是相同的,Java和

JavaScript是两种不同的野兽,我建议将你选择的

组限制在相关的组中。


Joe(MVP)

https:/ msgstr/ blockvote class = HI!我的代码出错了。

< SCRIPT language =" JavaScript">
If ifp ==""){
ifp =" default.htm"}
// - >< / SCRIPT>

基本上,如果用户直接输入
,我希望我的iframe有一个默认页面。


if(!(parent.frames [''myIframe''])

self.location =" http // server.name / site。 name / folder / default.html" ;;


如果主页没有iframe(或框架)nammed" myIframe"



在同一窗口中加载文件''default.htm''

路径为http // server.name / site.name / folder /"


或:

if(!(parent.frames [''myIframe''])

top.location =" http //server.name/site.name/folder/default.html" ;;


如果父页面没有iframe(或框架)nammedmyIframe

然后

在主窗口加载文件''default.htm''

路径为http // server.name / site。 name / folder /"

所以我需要这样做。所以我检查ifp值是否为
null如果是,那么为它赋值。这是正确的吗?



来自ifp的
(它是如何获得的价值)?

你用这个值做什么(在校正或不校正之后)?

-

Stephane Moriaux et son [moins] vieux Mac


ASM写道:


if(!(parent.frames [''myIframe' '])


if(!(parent.frames [''myIframe'']))

或:
if(!(parent) .frames [''myIframe''])




if(!(parent.frames [''myIframe'']))


-

Stephane Moriaux et son [moins] vieux Mac


HI! I get an error with this code.

<SCRIPT language="JavaScript">
If (ifp==""){
ifp="default.htm"}
//--></SCRIPT>

Basicly I want my iframe to have a default page if the user enters in
directly. so I need a way doing this. so I check to see if the ifp value is
null and if so then assign it a value. is this correct?
Thanks in advance :)

Paul

"Paul" <pa***********@sympatico.ca> wrote in message
news:uL*******************@news20.bellglobal.com.. .

HI! I get an error with this code.

<SCRIPT language="JavaScript">
If (ifp==""){
ifp="default.htm"}
//--></SCRIPT>

Basicly I want my iframe to have a default page if the user enters in
directly. so I need a way doing this. so I check to see if the ifp value is
null and if so then assign it a value. is this correct?
Thanks in advance :)

Paul


As you don''t state the error I may wrong but if, as I expect, it is "object
expected" then it''s because you have a capital "I" in "If" which should be
lowercase:

if (ifp == "")
{
ifp = "default.htm";
}

In general all JavaScript keywords start with lowercase letters, built-in
objects such as "String" are one such exception, and usually if two or more
words are concatenated all but the first have an uppercase first letter, e.g
"toLowerCase". An exception to this are the operators such as "typeof".
--
As a side point, although in this instance the syntax is the same, Java and
JavaScript are two different beasts and I suggest restricting your choice of
groups to the relevant ones.

Joe (MVP)

https://mvp.support.microsoft.com/pr...8-8741D22D17A5


Paul wrote:

HI! I get an error with this code.

<SCRIPT language="JavaScript">
If (ifp==""){
ifp="default.htm"}
//--></SCRIPT>

Basicly I want my iframe to have a default page if the user enters in
directly.
if(!(parent.frames[''myIframe''])
self.location="http//server.name/site.name/folder/default.html";

if main page doesn''t have an iframe (or frame) nammed "myIframe"
then
load in same window the file ''default.htm''
whom path is "http//server.name/site.name/folder/"

or :
if(!(parent.frames[''myIframe''])
top.location="http//server.name/site.name/folder/default.html";

if parent page doesn''t have an iframe (or frame) nammed "myIframe"
then
load in main window the file ''default.htm''
whom path is "http//server.name/site.name/folder/"
so I need a way doing this. so I check to see if the ifp value is
null and if so then assign it a value. is this correct?



from where comes ifp (how does it get ist value) ?
what do you do with this value (after correction or not) ?
--
Stephane Moriaux et son [moins] vieux Mac


ASM wrote:


if(!(parent.frames[''myIframe''])
if(!(parent.frames[''myIframe'']))
or :
if(!(parent.frames[''myIframe''])



if(!(parent.frames[''myIframe'']))

--
Stephane Moriaux et son [moins] vieux Mac


这篇关于我在这做错了什么。简单陈述。新手问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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