473,624 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript pseudo-protocol and event handlers

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

<input onkeyup="javasc ript: ..." />

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 4741
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="javasc ript: ..." />
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.javas cript 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="javasc ript: ..." />

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*******@yaho o.com> writes:
I've seen a few webpages that use the javascript pseudo-protocol with
event handlers. eg.

<input onkeyup="javasc ript: ..." />

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="javasc ript:while(true ){break javascript;}ale rt('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/rasterTriangleD OM.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
6991
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 outline, and when I pass the mouse over, the outline turns to red. #featured img { display: block; border: 1px solid #DCDFE8; padding: 1px;
6
3973
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 = document.all.tags("P"); Although I can change the paragraph colours using this array, the first letter of all the paragraphs remain the same
5
56562
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 the text to a string or array. Is it possible to create an array or string variable to do this? Any advice would be greatly appreciated. Thanks again. sean
14
4906
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 type="text/javascript"> no=math.random()*100 document.write (math.round(no)) </script>
104
16922
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 that array Could you show me a little example how to do this? Thanks.
37
3551
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. However, I can't seem to access the "hover" properties. example :
20
2142
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/ http://mochikit.com/ http://script.aculo.us/ And then there are even add-ons to some of these, such as:
9
2914
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 JavaScript. I have used a readymade javascript and there are variables like...
11
5178
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? waiting for reply Thank you
6
2154
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 this? any help will be truely appreciated.
0
8238
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
8680
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
8624
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
8336
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,...
1
6111
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4082
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...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
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.