473,545 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript: in location bar

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.

Mar 13 '06 #1
13 8277
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
Mar 14 '06 #2
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:func tion jsinput () {;
parent.MochaInp ut.document.wri te ("<b>JavaScr ipt input</b>");
parent.MochaInp ut.document.wri te ("<form action=JavaScri pt:
target=MochaOut put>");
parent.MochaInp ut.document.wri te ("<textarea name='isindex' rows=5
cols=50>");
parent.MochaInp ut.document.wri te ("</textarea><BR>") ;
parent.MochaInp ut.document.wri te ("<input type='submit' value='Run'>");
parent.MochaInp ut.document.wri te ("</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:func tion jsinput () {parent.MochaIn put.document.wr ite
("<b>JavaScr ipt input</b>") parent.MochaInp ut.document.wri te ("<form
action=JavaScri pt: target=MochaOut put>")
parent.MochaInp ut.document.wri te ("<textarea name='isindex' rows=5
cols=50>") parent.MochaInp ut.document.wri te ("</textarea><BR>")
parent.MochaInp ut.document.wri te ("<input type='submit' value='Run'>")
parent.MochaInp ut.document.wri te ("</form>") } ;

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

where is my mistake?

Mar 14 '06 #3
John Smith wrote:
when I paste my mini script at the location bar
javascript:func tion jsinput () {;
The ";" here is merely delimiting an empty statement.
parent.MochaInp ut.document.wri te ("<b>JavaScr ipt 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.MochaInp ut.document.wri te ("<form action=JavaScri pt:
target=MochaOut put>");
parent.MochaInp ut.document.wri te ("<textarea name='isindex' rows=5
cols=50>");
parent.MochaInp ut.document.wri te ("</textarea><BR>") ;
parent.MochaInp ut.document.wri te ("<input type='submit' value='Run'>");
parent.MochaInp ut.document.wri te ("</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:func tion jsinput () {parent.MochaIn put.document.wr ite
("<b>JavaScr ipt input</b>") parent.MochaInp ut.document.wri te ("<form
action=JavaScri pt: target=MochaOut put>")
parent.MochaInp ut.document.wri te ("<textarea name='isindex' rows=5
cols=50>") parent.MochaInp ut.document.wri te ("</textarea><BR>")
parent.MochaInp ut.document.wri te ("<input type='submit' value='Run'>")
parent.MochaInp ut.document.wri te ("</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:func tion jsinput ()
| {parent.MochaIn put.document.wr ite("<b>JavaScr ipt input</b>")
| parent.MochaInp ut.document.wri te ("<formaction=J avaScript:
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut.document.wri te
| ("</textarea><BR>") parent.MochaInp ut.document.wri te ("<input type='submit'
| value='Run'>")p arent.MochaInpu t.document.writ e ("</form>") } ;
| Line: 1, Column: 81
^^
| Source code:
| function jsinput () {parent.MochaIn put.document.wr ite("<b>JavaScr ipt
| input</b>") parent.MochaInp ut.document.wri te ("<formaction=J avaScript:
-------------^
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
^ there's another one
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut
^ and here, and so on.

That said, your "action=JavaScr ipt:" is utter nonsense.
Search the archives for "pseudo-protocol".
PointedEars
Mar 14 '06 #4
#1)
PointedEars wrote:
"You do not use a Gecko-based browser, such as Firefox, for testing
bookmarks. "
I downloaded Firefox 1.5 and tried typing
javascript:aler t("hello);
on the location bar. I purposedly missed the closing ", and expected a
javascript error message.
Instead once I hit "Enter", the screen does not change. no error
message, no popups, nothing.

Why?
#2)
"The error message I get in Firefox is
| Error: missing ; before statement
| Source file: javascript:func tion jsinput ()
| {parent.MochaIn put.document.wr ite("<b>JavaScr ipt input</b>")
| parent.MochaInp ut.document.wri te ("<formaction=J avaScript:
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut.document.wri te
| ("</textarea><BR>") parent.MochaInp ut.document.wri te ("<input
type='submit'
| value='Run'>")p arent.MochaInpu t.document.writ e ("</form>") } ;
| Line: 1, Column: 81
^^
| Source code:
| function jsinput () {parent.MochaIn put.document.wr ite("<b>JavaScr ipt
| input</b>") parent.MochaInp ut.document.wri te
("<formaction=J avaScript:
-------------^
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
^ there's another one
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut
^ and here, and so on. "

Where did The error message I get in Firefox is
| Error: missing ; before statement
| Source file: javascript:func tion jsinput ()
| {parent.MochaIn put.document.wr ite("<b>JavaScr ipt input</b>")
| parent.MochaInp ut.document.wri te ("<formaction=J avaScript:
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut.document.wri te
| ("</textarea><BR>") parent.MochaInp ut.document.wri te ("<input
type='submit'
| value='Run'>")p arent.MochaInpu t.document.writ e ("</form>") } ;
| Line: 1, Column: 81
^^
| Source code:
| function jsinput () {parent.MochaIn put.document.wr ite("<b>JavaScr ipt
| input</b>") parent.MochaInp ut.document.wri te
("<formaction=J avaScript:
-------------^
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
^ there's another one
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut
^ and here, and so on.
What commands did you give Firefox to view this error message?

Mar 14 '06 #5
#1)
PointedEars wrote:
"You do not use a Gecko-based browser, such as Firefox, for testing
bookmarks. "
I downloaded Firefox 1.5 and tried typing
javascript:aler t("hello);
on the location bar. I purposedly missed the closing ", and expected a
javascript error message.
Instead once I hit "Enter", the screen does not change. no error
message, no popups, nothing.

Why?
#2)
"The error message I get in Firefox is
| Error: missing ; before statement
| Source file: javascript:func tion jsinput ()
| {parent.MochaIn put.document.wr ite("<b>JavaScr ipt input</b>")
| parent.MochaInp ut.document.wri te ("<formaction=J avaScript:
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut.document.wri te
| ("</textarea><BR>") parent.MochaInp ut.document.wri te ("<input
type='submit'
| value='Run'>")p arent.MochaInpu t.document.writ e ("</form>") } ;
| Line: 1, Column: 81
^^
| Source code:
| function jsinput () {parent.MochaIn put.document.wr ite("<b>JavaScr ipt
| input</b>") parent.MochaInp ut.document.wri te
("<formaction=J avaScript:
-------------^
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
^ there's another one
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut
^ and here, and so on. "

Where did The error message I get in Firefox is
| Error: missing ; before statement
| Source file: javascript:func tion jsinput ()
| {parent.MochaIn put.document.wr ite("<b>JavaScr ipt input</b>")
| parent.MochaInp ut.document.wri te ("<formaction=J avaScript:
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut.document.wri te
| ("</textarea><BR>") parent.MochaInp ut.document.wri te ("<input
type='submit'
| value='Run'>")p arent.MochaInpu t.document.writ e ("</form>") } ;
| Line: 1, Column: 81
^^
| Source code:
| function jsinput () {parent.MochaIn put.document.wr ite("<b>JavaScr ipt
| input</b>") parent.MochaInp ut.document.wri te
("<formaction=J avaScript:
-------------^
| target=MochaOut put>")parent.Mo chaInput.docume nt.write ("<textarea
^ there's another one
| name='isindex' rows=5cols=50>" ) parent.MochaInp ut
^ and here, and so on.
What commands did you give Firefox to view this error message?

Mar 14 '06 #6
VK

John Smith wrote:
#1)
PointedEars wrote:
"You do not use a Gecko-based browser, such as Firefox, for testing
bookmarks. "
I downloaded Firefox 1.5 and tried typing
javascript:aler t("hello);
on the location bar. I purposedly missed the closing ", and expected a
javascript error message.
Instead once I hit "Enter", the screen does not change. no error
message, no popups, nothing.

Why?


Because you looked at the wront place.

Choose Tools > JavaScript Console
Press Clear to remove accumulated stuff
Type whatever you want in the Evaluate string and press Enter.
Press Clear again, close the console, type javascript:aler t("Hello);
and press Enter; open console again - here it is! :-)

Mar 14 '06 #7
Thanks for pointing out "Tools > JavaScript Console".

2 follow up questions:
1) The evaluate string is only 1 line. How do I evaluate a multiline
javascript snippet? Is there a better method than adding ; at the end
of each line and manually combining the say, 10 lines into 1 line?

e.g.
<SCRIPT>

function jsinput () {

parent.MochaInp ut.document.wri te ("<b>JavaScr ipt input</b>")

parent.MochaInp ut.document.wri te ("<form action=JavaScri pt:
target=MochaOut put>")

parent.MochaInp ut.document.wri te ("<textarea name='isindex' rows=5
cols=50>")

parent.MochaInp ut.document.wri te ("</textarea><BR>")

parent.MochaInp ut.document.wri te ("<input type='submit' value='Run'>")

parent.MochaInp ut.document.wri te ("</form>")

}

</SCRIPT>

<FRAMESET ROWS="50%%,50%% ">
<FRAME NAME="MochaOutp ut" SRC="about:blan k">
<FRAME NAME="MochaInpu t" SRC="javascript :parent.jsinput ()">
</FRAMESET>

#2) The above function jsinput() is called by another HTML element
(<FRAME> in this case). How do I include the HTML code in the
Evaluation process?

Mar 14 '06 #8
John Smith wrote:
#1)
PointedEars wrote:
"You do not use a Gecko-based browser, such as Firefox, for testing
bookmarks. "
I downloaded Firefox 1.5 and tried typing
javascript:aler t("hello);
on the location bar. I purposedly missed the closing ", and expected a
javascript error message.
Instead once I hit "Enter", the screen does not change. no error
message, no popups, nothing.

Why?
Because you did not read the FAQ.
[...]
What commands did you give Firefox to view this error message?


Read the FAQ <URL:http://jibbering.com/faq/>, especially FAQ 4.43.

Furthermore, I recommend to install the Web Developer, Console^2,
and FireBug extensions.
PointedEars
Mar 14 '06 #9
John Smith wrote:
1) The evaluate string is only 1 line. How do I evaluate a multiline
javascript snippet? Is there a better method than adding ; at the end
of each line and manually combining the say, 10 lines into 1 line?
I use the JavaScript Console feature from ContextMenu Extensions, and
the Open Execute JS extension for this, unless I create a test case
HTML document.
e.g.
<SCRIPT>
The `type' attribute is required:

<script type="text/javascript">
[...]
Will you stop posting the same code over and over again?
Use Message-ID URIs for references if you have to:

news:11******** *************@u 72g2000cwu.goog legroups.com
<FRAMESET ROWS="50%%,50%% "> ^^ ^^
Nonsense. <URL:http://validator.w3.or g/>
<FRAME NAME="MochaOutp ut" SRC="about:blan k">
Nonsense. about:blank is proprietary.
<FRAME NAME="MochaInpu t" SRC="javascript :parent.jsinput ()">
Nonsense. javascript: is proprietary.
</FRAMESET>

#2) The above function jsinput() is called by another HTML element
(<FRAME> in this case). How do I include the HTML code in the
Evaluation process?


(Pardon?) You do not. HTML code is not script code.
And please learn to quote:

<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1P ost>
<URL:http://www.safalra.com/special/googlegroupsrep ly/>
PointedEars
Mar 14 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3818
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following beautiful script "http://javascript.internet.com/navigation/toolbar-menu.html". It works like a charm. I made my webpage in frames, where the...
0
7465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.