473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

javascript pseudo-protocol and event handlers

I've seen a few webpages that use the javascript pseudo-protocol with
event handlers. eg.

<input onkeyup="javascript: ..." />

Correct me if I'm wrong, but isn't onkeyup always supposed to be
javascript, anyway? As such, isn't usint hte javascript
pseudo-protocol redundant?

....or was it required on some archaic browser like Netscape 4.0 or
something?

Jun 23 '06 #1
3 4709
yawnmoth said the following on 6/23/2006 4:41 PM:
I've seen a few webpages that use the javascript pseudo-protocol with
event handlers. eg.

<input onkeyup="javascript: ..." />
Usually because they don't know better. Or, they are using VBScript in
the same page.
Correct me if I'm wrong, but isn't onkeyup always supposed to be
javascript, anyway? As such, isn't usint hte javascript
pseudo-protocol redundant?
Depending on whether it is IE or not and what the default script
language in the page is.
....or was it required on some archaic browser like Netscape 4.0 or
something?


No.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices -
Jun 23 '06 #2
yawnmoth wrote:
Correct me if I'm wrong, but isn't onkeyup always supposed to be
javascript, anyway? As such, isn't usint hte javascript
pseudo-protocol redundant?


Kind of redundant, but in reality it's a completely different meaning that
uses the same syntax by chance.

In an example like
<input onkeyup="javascript: ..." />

the "javascript:" is acting as a label, which is allow in javascript code.
So it doesn't create an error, even thouh it serves no purpose and is surely
caused by someone not understand what the javascript: pseudo-protocol is and
where it (used to) be used.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Jun 23 '06 #3
"yawnmoth" <te*******@yahoo.com> writes:
I've seen a few webpages that use the javascript pseudo-protocol with
event handlers. eg.

<input onkeyup="javascript: ..." />

Correct me if I'm wrong, but isn't onkeyup always supposed to be
javascript, anyway?
It's supposed to be the script langauge set as the Content-Script-Type
(e.g., <meta http-equiv="Content-Script-Type" content="text/javascript">)
but all browsers default to Javascript if nothing else is specified.

In IE, it's possible to have a default language of VBScript. In order
to allow event handlers in Javascript anyway, the prefix "javascript:"
will make IE treat the content as Javascript independently of what
the default language is.

In all other browsers it's just a label, which can be seen by this
example:
<div onclick="javascript:while(true){break javascript;}alert('done')">
X</div>
click the X and see an alert in non-IE browsers and an error in IE
(unknown label).
As such, isn't usint hte javascript pseudo-protocol redundant?
If that was what it meant, it would be redundant. Actually, it's just
misguided.
...or was it required on some archaic browser like Netscape 4.0 or
something?


No, never. The only place where it has any use is in multi-script-
language pages written specifically for IE. In a page meant for the
internet, any occurence of "javascript:" should be considered a
problem[1]

/L
[1] Unless you are showing off your bookmarklets.
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jun 24 '06 #4

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

Similar topics

8
by: Kerberos | last post by:
As you might know, IE doesn't support the :hover pseudo-class on every tag (just the "a" tag AFAIK) Is there a simple JavaScript that would solve the problem? I have images that have a light blue...
6
by: Fungii | last post by:
Hello, I have a stylesheet that sets p:first-letter to a certain size and colour. I was playing around with Javascript to change paragraph stylesheets using an array like this: var paras =...
5
by: seans | last post by:
Hi, Is there a way to create a static variable in Javascript? I want to use a recursive function to traverse a DOM tree and examine each node. If the node is a text object I would like to save...
14
by: Debbie Lucier | last post by:
How would I generate a even random number each time? I can generate a random number each time but not an even one? Here is the code I use for the random number from 1-100. <script...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
37
by: pochartrand | last post by:
Hello, Is there a way to manipulate or at least read the pseudo-class of an element ? I know the style attribute can be accessed and gives the CSS properties for a particular element....
20
by: Neo Geshel | last post by:
I have been looking into Javascript libraries for the last week or two here, and there are certainly a lot of options out there. http://www.prototypejs.org/ http://mootools.net/...
9
by: Mahernoz | last post by:
Hello Friends, The JavaScript File exmplmenu_var.js contains the code... (for the sake of brevity i am showing only that code which needs to be changed) I am actually developing a menu using...
11
by: sanju | last post by:
Dear All, I have html table and this table contains 10 Rows and 2 column, I want every time this HTML page is called by the user to view the rows Randomly. How can I do this from JavaScript? ...
6
by: Archana | last post by:
Hi all, i am facing one problem with status bar of IE. when i execute any javascript function or navigate to any link it is showing me that in status bar which i don't want. how will ido...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.