对选择没有影响 [英] No effect on selection

查看:65
本文介绍了对选择没有影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我真的希望这个帖子不违反网络礼节。


我键入了从p复制的一些代码。完整参考HTML的530

第三版这是一本很受欢迎的书。我已在下面列出以防万一

有人可能想将其粘贴到网页中。


它看起来很漂亮 - 下拉菜单工作 - 和选择是现货

,但它没有得到任何东西。我希望它连接到

选择的网站但没有任何反应。可能是因为IE阻止了交互式的

代码,或者可能是代码是否缺少b $ b。


我想用它作为导航栏的基础,就像我到目前为止一样接近




Colin

代码如下:

<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN">

< HTML>

< HEAD>

< title>选择导航< / title>

< style type = " text / css">

<! -

.nochoice {color:black;}

.choice {color:蓝色;}


- >

< / style>

< script language =" Javascript"> ;

<! -

函数重定向(下拉){

newlocation = pulldown [pulldown.selectedIndex] .value;

if(newlocation!="")

self.location = newlocation;

}

functio n resetiflalank(pulldown){

possiblenewlocation = pulldown [pulldown.selectedIndex] .value;

if(possiblenewlocation =="")

pulldown.selectedIndex = 0; / *重置开始* /;

}

// - >

< / script>

< / head>

< body>

< form name =" navForm">

< b>最喜欢的网站:< / b>

< select name =" menu" ID = QUOT;菜单" onChange =" resetIfBlank(this)">


< option value =""类= QUOT; nochoice"选择>选择您的网站< / option>

< option value ="" class =" nochoice">< / option>

< option value ="" class =" nochoice"> Search Sites< / option>

< option value =""

class =" nochoice"> --- ------------------------------< / option>

< option value =" HTTP://www.yahoo.com" class =" choice"> Yahoo< / option>

< option value =" http://www.hotbot.com" class =" choice"> Hotbot< / option>

< option value =" http://www.google.com" class =" choice"> Google< / option>

< option value ="" class =" nochoice">< / option>

< option value ="" class =" nochoice">演示< /选项>

<选项值=""

class =" nochoice"> ---- -----------------------------< / option>

< option value =" http ://www.democompany.com" class =" choice">演示

公司< / option>


< / select>

<输入类型= QUOT按钮" value =" go"

onclick =" redirect(document.navForm.menu)">


< / form>

< script>

<! -

document.navForm.menu.selectedIndex = 0;

// - >


< / script>

< / body>

< / HTML>

Hi

I really hope that this posting is not a breach of netiquette.

I keyed in some code copied from p.530 of The Complete Reference HTML
Third Edition which is a popular book. I have listed it below in case
someone might want to paste it into a web page.

It looks pretty - the drop down menu works- and the selection is spot
on, but it doesn''t get anything. I expected it to connect to the
selected web site but nothing happens. Could it be that interactive
code is being blocked by IE, or could it be that the code is
deficient.

I wanted to use it as the basis for a navigation bar and this is as
close as I''ve been so far.

Colin

The code follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<title>Select Navigation</title>
<style type="text/css">
<!--
.nochoice {color: black;}
.choice {color: blue;}

-->
</style>
<script language = "Javascript">
<!--
function redirect(pulldown) {
newlocation = pulldown[pulldown.selectedIndex].value;
if (newlocation != "")
self.location = newlocation;
}
function resetifblank(pulldown){
possiblenewlocation = pulldown[pulldown.selectedIndex].value;
if (possiblenewlocation == "")
pulldown.selectedIndex = 0; /* reset to start */;
}
//-->
</script>
</head>
<body>
<form name = "navForm">
<b>Favourite Sites:</b>
<select name="menu" id="menu" onChange="resetIfBlank(this)">

<option value="" class="nochoice" selected> Choose your site</option>
<option value="" class="nochoice"></option>
<option value="" class="nochoice">Search Sites</option>
<option value=""
class="nochoice">---------------------------------</option>
<option value="http://www.yahoo.com" class="choice">Yahoo</option>
<option value="http://www.hotbot.com" class="choice">Hotbot</option>
<option value="http://www.google.com" class="choice">Google</option>
<option value="" class="nochoice"></option>
<option value="" class="nochoice">Demos</option>
<option value=""
class="nochoice">---------------------------------</option>
<option value="http://www.democompany.com" class="choice">Demo
Company</option>

</select>
<input type="button" value="go"
onclick="redirect(document.navForm.menu)">

</form>
<script>
<!--
document.navForm.menu.selectedIndex = 0;
//-->

</script>
</body>
</HTML>

推荐答案


me@privacy.net 已写:

< snip>

函数resetifblank(下拉菜单)

< snip>

.... onChange =" resetIfBlank(this)">


你必须做出选择如何调用你的函数(JavaScript

区分大小写)。


me@privacy.net wrote:
<snip>
function resetifblank(pulldown)
<snip>
.... onChange="resetIfBlank(this)">

You have to make a choice how will your function be called (JavaScript
is case-sensitive).


2006年4月15日02:46:57 -0700,VK < SC ********** @ yahoo.com>写道:
On 15 Apr 2006 02:46:57 -0700, "VK" <sc**********@yahoo.com> wrote:

me@privacy.net写道:
< snip>
函数resetifblank(下拉)
< snip>
... onChange =" resetIfBlank(this)">

你必须做出选择如何调用你的函数(JavaScript
区分大小写) 。

me@privacy.net wrote:
<snip>
function resetifblank(pulldown)
<snip>
... onChange="resetIfBlank(this)">

You have to make a choice how will your function be called (JavaScript
is case-sensitive).




谢谢,


我从未猜到这是我的错!


Colin



Thanks,

I never guessed it was my mistake!

Colin


2006年4月15日星期六09:38:37 GMT,< me@privacy.net>写道:
On Sat, 15 Apr 2006 09:38:37 GMT, <me@privacy.net> wrote:


我真的希望这个帖子不违反网络礼节。

我键入了一些复制的代码摘自完整参考HTML
第三版第530页,这本书很受欢迎。我已在下面列出以防万一有人可能想把它粘贴到一个网页中。

看起来很漂亮 - 下拉菜单有效 - 选择是现场
,但它没有得到任何东西。我希望它能连接到选定的网站,但没有任何反应。可能是因为IE阻止了交互式代码,或者代码是否有缺陷。

我想用它作为导航栏的基础这就像我到目前为止一样接近。

科林

代码如下:

<! DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN">
< HTML>
< HEAD>
< title>选择导航< / title> ;
< style type =" text / css">
<! -
.nochoice {color:black;}
.choice {color:blue; }

- >
< / style>
< script language =" Javascript">
<! -
function redirect(pulldown){
newlocation = pulldown [pulldown.selectedIndex] .value;
if(newlocation!="")
self.location = newlocation;
}

function resetifblank(pulldown){
possiblenewlocation = pulldown [pulldown.selectedIndex] .value;
if(possiblenewlocation ==" ;")
pulldown.selectedIndex = 0; / *重置开始* /;
}
// - >
< / script>
< / head>
< body>
< form name =" navForm">
< b>收藏的网站:< / b>

< select name =" menu" ID = QUOT;菜单" onChange =" resetIfBlank(this)">

< option value =""类= QUOT; nochoice"选择>选择您的网站< / option>
< option value ="" class =" nochoice">< / option>
< option value ="" class =" nochoice">搜索网站< / option>
< option value =""
class =" nochoice"> ----------- ----------------------< / option>
< option value =" http://www.yahoo.com" class =" choice"> Yahoo< / option>
< option value =" http://www.hotbot.com" class =" choice"> Hotbot< / option>
< option value =" http://www.google.com" class =" choice"> Google< / option>
< option value ="" class =" nochoice">< / option>
< option value ="" class =" nochoice"> Demos< / option>
< option value =""
class =" nochoice"> ------------ ---------------------< / option>
< option value =" http://www.democompany.com" class =" choice"> Demo
公司< / option>

< / select>
< input type =" button" value =" go"
onclick =" redirect(document.navForm.menu)">

< / form>
< script>
<! -
document.navForm.menu.selectedIndex = 0;
// - >

< / script>
< /正文>
< / HTML>
Hi

I really hope that this posting is not a breach of netiquette.

I keyed in some code copied from p.530 of The Complete Reference HTML
Third Edition which is a popular book. I have listed it below in case
someone might want to paste it into a web page.

It looks pretty - the drop down menu works- and the selection is spot
on, but it doesn''t get anything. I expected it to connect to the
selected web site but nothing happens. Could it be that interactive
code is being blocked by IE, or could it be that the code is
deficient.

I wanted to use it as the basis for a navigation bar and this is as
close as I''ve been so far.

Colin

The code follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<title>Select Navigation</title>
<style type="text/css">
<!--
.nochoice {color: black;}
.choice {color: blue;}

-->
</style>
<script language = "Javascript">
<!--
function redirect(pulldown) {
newlocation = pulldown[pulldown.selectedIndex].value;
if (newlocation != "")
self.location = newlocation;
}
function resetifblank(pulldown){
possiblenewlocation = pulldown[pulldown.selectedIndex].value;
if (possiblenewlocation == "")
pulldown.selectedIndex = 0; /* reset to start */;
}
//-->
</script>
</head>
<body>
<form name = "navForm">
<b>Favourite Sites:</b>
<select name="menu" id="menu" onChange="resetIfBlank(this)">

<option value="" class="nochoice" selected> Choose your site</option>
<option value="" class="nochoice"></option>
<option value="" class="nochoice">Search Sites</option>
<option value=""
class="nochoice">---------------------------------</option>
<option value="http://www.yahoo.com" class="choice">Yahoo</option>
<option value="http://www.hotbot.com" class="choice">Hotbot</option>
<option value="http://www.google.com" class="choice">Google</option>
<option value="" class="nochoice"></option>
<option value="" class="nochoice">Demos</option>
<option value=""
class="nochoice">---------------------------------</option>
<option value="http://www.democompany.com" class="choice">Demo
Company</option>

</select>
<input type="button" value="go"
onclick="redirect(document.navForm.menu)">

</form>
<script>
<!--
document.navForm.menu.selectedIndex = 0;
//-->

</script>
</body>
</HTML>




您好


我已经更正了代码,现在工作正常。


我想改变下面这一行,以便它在

相同的文件夹中调用一个网页,但它不会用我的代码来做。


< option value =" http://www.democompany.com" class =" choice">演示

公司< / option>


我试过:

< option value = " p70.htm" class =" choice"> Page 370< / option>


其中p370.htm是我要加载的页面。


完整路径为D:\webs \HTML \ p370.htm。带代码的页面在

相同的文件夹中。


我已经尝试过很多其他猜测但无济于事

我已经尝试了完整的相对引用href =" filename.ext"并且它b / b
不起作用。请有人帮忙。


Colin



Hi

I have corrected the code and it works fine now.

I wanted to change the line below so that it called a web page in the
same folder but it won''t do it with my code.

<option value="http://www.democompany.com" class="choice">Demo
Company</option>

I tried :
<option value="p70.htm" class="choice">Page 370</option>

where p370.htm is the page I wanted to load.

The full path is D:\webs\HTML\p370.htm. The page with the code is in
the same folder.

I have tried lots of other guesses but to no avail
I have tried the full relative reference href="filename.ext" and it
doesn''t work. Can anyone help, please.

Colin


这篇关于对选择没有影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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