javascript:在位置栏中 [英] javascript: in location bar

查看:55
本文介绍了javascript:在位置栏中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IE 6.0

来自
http://www.javaworld.com/javaworld/j...script-p2.html


我收集

"如果你需要测试多个命令行,你可以通过输入javascript <来减少

键击/ b> :(记住冒号)在位置

框中。导航器显示JavaScript typein。

窗口底部的框架。键入要尝试的命令行,然后按Enter键。


如何获得类似的JavaScript类型用IE 6.0框架,所以

我可以输入* multiple * javascript命令行吗?


谢谢。

解决方案

John Smith于2006年3月14日8:00 AM AEST:

我使用的是IE 6.0

来自
http ://www.javaworld.com/javaworld/j...script-p2.html

我收集到了
如果你需要测试一些命令你可以通过在位置
框中输入javascript :(记住冒号)来减少击键次数。导航器显示JavaScript typein。窗口底部的框架。键入要尝试的命令行,然后按Enter键。

如何获得类似的JavaScript类型框架与IE 6.0,所以我可以输入* multiple * javascript命令行?




使用文本编辑器编写正常的缩进代码 - 可能会最小化

空格而不是缩进。使用find / replace将所有

连续空格替换为单个空格。复制&将其粘贴到

命令行。


当它运行时,将其保存为书签。

-

Rob


RobG写道:

John Smith于2006年3月14日8:00 AM AEST:< blockquote class =post_quotes>我使用的是IE 6.0

http://www.javaworld.com/javaworld/j...script-p2.html
如果您需要测试多个命令行,可以通过在位置输入javascript :(记住冒号)来减少击键次数
盒子。导航器显示JavaScript typein。窗口底部的框架。键入要尝试的命令行,然后按Enter键。

如何获得类似的JavaScript类型用IE 6.0框架,所以我可以输入* multiple * javascript命令行吗?



使用文本编辑器编写正常的缩进代码 - 也许最小化
除了缩进之外的空格。使用find / replace将所有
连续的空格替换为单个空格。复制&将其粘贴到
命令行。

当它运行时,将其保存为书签。



当我粘贴我的迷你脚本时位置栏

javascript :function jsinput(){;

parent.MochaInput.document.write("< b> JavaScript输入< ; / b>");

parent.MochaInput.document.write("< form action = javascript

target = MochaOutput>");

parent.MochaInput.document.write("< textarea name =''isindex''rows = 5

cols = 50>" ;);

parent.MochaInput.document.write("< / textarea>< BR>");

parent.MochaInput.document.write( "< input type =''submit''value ='''运行''>");

parent.MochaInput.document.write("< / form>" );

};


i得到以下javascript错误:

预期''}''

(我试图删除所有;在t他结束了每一行,我仍然得到了

相同的错误)


显然位置栏只占我脚本的第一行。

如果我尝试将所有代码放在1行,用;最后,我还有:

javascript :function jsinput(){parent.MochaInput.document.write

("< b> JavaScript输入< / b>")parent.MochaInput.document.write("< form

action = javascript :target = MochaOutput>")

parent.MochaInput.document.write("< textarea name =''isindex''rows = 5

cols = 50>")parent.MochaInput。 document.write("< / textarea>< BR>")

parent.MochaInput.document.write("< input type =''submit''value =''运行''>")

parent.MochaInput.document.write("< / form>")};


我有一个javascript错误,声明:

预期'';''

代码0


哪里是我的错?


John Smith写道:

当我将迷你脚本粘贴到位置栏时
javascript :福ning jsinput(){;


;这里只是分隔一个空的陈述。

parent.MochaInput.document.write("< b> JavaScript input< / b>");


;这里是必需的,除非下一行声明在下一行。


为了代码风格,在(&;; it
是一个方法调用,而(...)部分是参数列表,属于

被调用方法的标识符。

parent.MochaInput.document.write("< form action = javascript
target = MochaOutput>");
parent.MochaInput.document.write ("< textarea name =''isindex''rows = 5
cols = 50>");
parent.MochaInput.document.write("< / textarea>< BR> ;");
parent.MochaInput.document.write("< input type =''submit''value =''Run''>");
parent.MochaInput。 document.write("< / form>");
};

我收到了以下javascript错误:
预期''}''
(我试图删除所有;在每一行的末尾,我仍然有相同的错误)

显然位置栏只占用我脚本的第一行。


显然,对于基于Gecko的浏览器来说,情况并非如此。

copypeasted代码中的换行符似乎被标准化为空格字符。

如果我尝试将所有代码放在1行,带有;最后,我仍然得到:
javascript :function jsinput(){parent.MochaInput.document.write
(< b> JavaScript输入< / b> ")parent.MochaInput.document.write("< form
action = javascript :target = MochaOutput>")
parent.MochaInput.document.write( "< textarea name =''isindex''rows = 5
cols = 50>")parent.MochaInput.document.write("< / textarea>< BR>")
parent.MochaInput.document.write("< input type =''submit''value =''Run''>")
parent.MochaInput.document.write("< / form>")};

我收到了一个javascript错误,声明:
预期'';''
代码0

其中是我的错误?




您不使用基于Gecko的浏览器(如Firefox)来测试

书签。 JScript'(IE')的错误消息通常很奇怪,如果

没有误导性,而SpiderMonkey'的错误消息通常很多

更有帮助,因为他们往往更冗长。 (还记得

直升机微笑开玩笑吗?)


我在Firefox中收到的错误消息是


|错误:遗漏;在声明之前

|源文件:javascript :函数jsinput()

| {parent.MochaInput.document.write("< b> JavaScript输入< / b>")

| parent.MochaInput.document.write(" formaction = javascript

| target = MochaOutput>")parent.MochaInput.document.wr ite(" < textarea

| name =''isindex''rows = 5cols = 50>")parent.MochaInput.document.write

| (< / textarea>< BR>")parent.MochaInput.document.write("< input type =''submit''

| value =''Run' '>")parent.MochaInput.document.write("< / form>")};

|行:1,栏目:81

^^

|源代码:

| function jsinput(){parent.MochaInput.document.write("< b> JavaScript

| input< / b>")parent.MochaInput.document.write("< formaction = javascript

------------- ^

| target = MochaOutput>")parent。 MochaInput.document.wr ite("< textarea

^还有另一个

| name =''isindex''rows = 5cols = 50>" ;)parent.MochaInput

^和这里,依此类推。


那就是说,你的action = javascript : "完全是胡说八道。

搜索档案中的伪协议。

PointedEars


I am using IE 6.0

from
http://www.javaworld.com/javaworld/j...script-p2.html

I gather that
"If you need to test a number of command lines, you can reduce the
keystrokes by typing javascript: (remember the colon) in the Location
box. Navigator displays a "JavaScript typein" frame at the bottom of
the window. Type the command line you want to try, and press Enter. "

How can obtain a similiar "JavaScript typein" frame with IE 6.0, so
that I can enter *multiple* javascript command lines?

Thanks.

解决方案

John Smith said on 14/03/2006 8:00 AM AEST:

I am using IE 6.0

from
http://www.javaworld.com/javaworld/j...script-p2.html

I gather that
"If you need to test a number of command lines, you can reduce the
keystrokes by typing javascript: (remember the colon) in the Location
box. Navigator displays a "JavaScript typein" frame at the bottom of
the window. Type the command line you want to try, and press Enter. "

How can obtain a similiar "JavaScript typein" frame with IE 6.0, so
that I can enter *multiple* javascript command lines?



Use a text editor to write normal, indented code - maybe minimize
whitespace other than for indenting. Use find/replace to replace all
contiguous whitespace with a single space. Copy & paste that into the
command line.

When you get it working, save it as a bookmark.
--
Rob


RobG wrote:

John Smith said on 14/03/2006 8:00 AM AEST:

I am using IE 6.0

from
http://www.javaworld.com/javaworld/j...script-p2.html

I gather that
"If you need to test a number of command lines, you can reduce the
keystrokes by typing javascript: (remember the colon) in the Location
box. Navigator displays a "JavaScript typein" frame at the bottom of
the window. Type the command line you want to try, and press Enter. "

How can obtain a similiar "JavaScript typein" frame with IE 6.0, so
that I can enter *multiple* javascript command lines?



Use a text editor to write normal, indented code - maybe minimize
whitespace other than for indenting. Use find/replace to replace all
contiguous whitespace with a single space. Copy & paste that into the
command line.

When you get it working, save it as a bookmark.


when I paste my mini script at the location bar
javascript:function jsinput () {;
parent.MochaInput.document.write ("<b>JavaScript input</b>");
parent.MochaInput.document.write ("<form action=javascript:
target=MochaOutput>");
parent.MochaInput.document.write ("<textarea name=''isindex'' rows=5
cols=50>");
parent.MochaInput.document.write ("</textarea><BR>");
parent.MochaInput.document.write ("<input type=''submit'' value=''Run''>");
parent.MochaInput.document.write ("</form>");
};

i got the following javascript error:
Expected ''}''
(i tried removing all the ; at the end of each line and i still got the
same error)

apparently the location bar is only taking the first line of my script.
If i try putting all code on 1 line, with a ; at the end, i still got:
javascript:function jsinput () {parent.MochaInput.document.write
("<b>JavaScript input</b>") parent.MochaInput.document.write ("<form
action=javascript: target=MochaOutput>")
parent.MochaInput.document.write ("<textarea name=''isindex'' rows=5
cols=50>") parent.MochaInput.document.write ("</textarea><BR>")
parent.MochaInput.document.write ("<input type=''submit'' value=''Run''>")
parent.MochaInput.document.write ("</form>") } ;

I got a javascript error that stated:
Expected '';''
Code 0

where is my mistake?


John Smith wrote:

when I paste my mini script at the location bar
javascript:function jsinput () {;
The ";" here is merely delimiting an empty statement.
parent.MochaInput.document.write ("<b>JavaScript input</b>");
The ";" here is required, unless the next statement is on the next line.

For the sake of code style, there should not be a space before the "("; it
is a method call, and the "(...)" part is the argument list that belongs to
the identifier of the called method.
parent.MochaInput.document.write ("<form action=javascript:
target=MochaOutput>");
parent.MochaInput.document.write ("<textarea name=''isindex'' rows=5
cols=50>");
parent.MochaInput.document.write ("</textarea><BR>");
parent.MochaInput.document.write ("<input type=''submit'' value=''Run''>");
parent.MochaInput.document.write ("</form>");
};

i got the following javascript error:
Expected ''}''
(i tried removing all the ; at the end of each line and i still got the
same error)

apparently the location bar is only taking the first line of my script.
Apparently that is not true for Gecko-based browsers. A newline in
copypasted code appears to be normalized to a space character.
If i try putting all code on 1 line, with a ; at the end, i still got:
javascript:function jsinput () {parent.MochaInput.document.write
("<b>JavaScript input</b>") parent.MochaInput.document.write ("<form
action=javascript: target=MochaOutput>")
parent.MochaInput.document.write ("<textarea name=''isindex'' rows=5
cols=50>") parent.MochaInput.document.write ("</textarea><BR>")
parent.MochaInput.document.write ("<input type=''submit'' value=''Run''>")
parent.MochaInput.document.write ("</form>") } ;

I got a javascript error that stated:
Expected '';''
Code 0

where is my mistake?



You do not use a Gecko-based browser, such as Firefox, for testing
bookmarks. JScript''s (IE''s) error messages are often bizarre, if
not misleading, while SpiderMonkey''s error messages are often much
more helpful, because they are often much more verbose. (Remember
the helicopter Microsoft joke?)

The error message I get in Firefox is

| Error: missing ; before statement
| Source file: javascript:function jsinput ()
| {parent.MochaInput.document.write("<b>JavaScript input</b>")
| parent.MochaInput.document.write ("<formaction=javascript:
| target=MochaOutput>")parent.MochaInput.document.wr ite ("<textarea
| name=''isindex'' rows=5cols=50>") parent.MochaInput.document.write
| ("</textarea><BR>")parent.MochaInput.document.write ("<input type=''submit''
| value=''Run''>")parent.MochaInput.document.write ("</form>") } ;
| Line: 1, Column: 81
^^
| Source code:
| function jsinput () {parent.MochaInput.document.write("<b>JavaScript
| input</b>") parent.MochaInput.document.write ("<formaction=javascript:
-------------^
| target=MochaOutput>")parent.MochaInput.document.wr ite ("<textarea
^ there''s another one
| name=''isindex'' rows=5cols=50>") parent.MochaInput
^ and here, and so on.

That said, your "action=javascript:" is utter nonsense.
Search the archives for "pseudo-protocol".
PointedEars


这篇关于javascript:在位置栏中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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