473,851 Members | 2,058 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 8327
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
3854
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 nav-frame shows the menubar, so whenever I click a link in the menubar, it opens in the frame below. But...
0
9898
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 usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9748
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11020
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10670
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7073
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5736
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4143
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.