I see some code examples like this:
<DIV onmouseover="th is.style.backgr ound='blue'">
and other code examples like this:
<DIV onmouseover="ja vascript:this.s tyle.background ='blue'">
Which way is more proper? Or are both ways perfectly fine? Are there any
specifications that discuss when "javascript :" should be put in front of code?
Jul 20 '05
25 3730
Janwillem Borleffs wrote: <de*******@no.s pam.com> schreef in bericht news:3f******** *******@news.md .comcast.gigane ws.com...
Please shorten your attribution to one line, leaving
out information not vital to follow the discussion. I see some code examples like this:
<DIV onmouseover="th is.style.backgr ound='blue'">
and other code examples like this:
<DIV onmouseover="ja vascript:this.s tyle.background ='blue'">
Which way is more proper? Or are both ways perfectly fine? Are there any specifications that discuss when "javascript :" should be put in front of code?
^^
OE Quotefix repairs borken quotes. OTOH, you could switch
to NetNews client software that works by default.
The first one is the proper way,
The statement is correct.
because the onmouseover attribute (and other event handlers) expects the value to contain JS code only.
However, the explanation is awfully wrong.
First, values of the intrinsic event handler attributes may be of *any*
script language. The default script language can be specified with the
<meta http-equiv="Content-Script-Type" content="...">
element, defining it with the value of the `content' attribute. For
JavaScript, a value of `text/javascript' is appropriate.
The default script language is text/javascript in Mozilla/5.0 and
JScript (text/jscript?) in Internet Explorer.
Second, the `javascript:' within the event handler is considered one of
the following:
A) UAs using the IE browser component: A label specifying the script
language
B) Other UAs: A label that is ignored since no statement refers to it.
C) Incorrect syntax, which triggers a script error.
*That* is why it is wrong.
What you will also see very often, is the usage of the javascript: pseudo protocol in anchors:
Third, `javascript :' is not a pseudo protocol (I would like give the
person who introduced that ridiculous term a good kick in the ass),
but an URI scheme.
PointedEars
Jim Ley wrote: Michael Winter wrote: For JavaScript, the MIME type is text/javascript [...]
Could you cite the relevant RFC which indicates this please? for JavaScript (capatilised like that) the relevant one would be application/x-javascript surely?
No for both answers. Alas, there is no standardized MIME type for
JavaScript code. Nevertheless, text/javascript is, in contrast to
application/x-javascript, widely supported and therefore used in
the HTML 4.01 Specification itself.
PointedEars
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes: The default script language is text/javascript in Mozilla/5.0 and JScript (text/jscript?) in Internet Explorer.
Both text/jscript and text/javascript will work in IE. They both
trigger the same (JScrip) interpreter.
Second, the `javascript:' within the event handler is considered one of the following:
A) UAs using the IE browser component: A label specifying the script language B) Other UAs: A label that is ignored since no statement refers to it.
It can, but then it will fail in IE.
C) Incorrect syntax, which triggers a script error.
Which will not happen in any browser I have seen, since it would require
the browser to interpret the contents as something other than Javascript,
and only IE allows other languages at all.
*That* is why it is wrong.
For some value of "wrong" :)
Third, `javascript:' is not a pseudo protocol (I would like give the person who introduced that ridiculous term a good kick in the ass), but an URI scheme.
So, http is a protocol, but http: is an URI scheme, correct?
/L
--
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.'
On Mon, 08 Dec 2003 00:56:36 +0100, Thomas 'PointedEars' Lahn
<Po*********@we b.de> wrote: It is used in the Recommendation because it is widely supported.
That doesn't work, so are lots of HTML features not included in the
spec. The HTML WG has no more status than me or you on what is the mime-type for js, you'll note the SVG WG say it's text/ecmascript.
You know that text/ecmascript targets a different language.
WHAT? what "different language" does it target?
Besides, that is not standardized as well.
Indeed, but it's widely supported... these should not be using any
examples that are wrong. http://lists.w3.org/Archives/Public/...2Aug/0008.html
What about it? It's not different to what I was arguing here, it's
wrong for W3 WG's to recommend unregistered mime-types not in the x-
tree.
Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/
"Lasse Reichstein Nielsen" <lr*@hotpop.com > wrote in message
news:y8******** **@hotpop.com.. .
<snip> C) Incorrect syntax, which triggers a script error.
Which will not happen in any browser I have seen, since it would require the browser to interpret the contents as something other than Javascript, and only IE allows other languages at all.
<snip>
According to my Netscape JavaScript 1.5 reference labels were introduced
in JavaScript 1.2 so in principal an environment supporting only
JavaScript <= 1.1 probably will consider event handling attribute code
prefixed with "javascript :" as a syntax error. But then, anyone still
using a JavaScript <= 1.1. UA is likely to be finding its use nearly
totally unproductive anyway.
Richard.
JRS: In article <3F************ **@PointedEars. de>, seen in
news:comp.lang. javascript, Thomas 'PointedEars' Lahn
<Po*********@we b.de> posted at Mon, 8 Dec 2003 00:38:14 :- Janwillem Borleffs wrote:
<de*******@no.s pam.com> schreef in bericht news:3f******** *******@news.md .comcast.gigane ws.com...
Please shorten your attribution to one line, leaving out information not vital to follow the discussion.
Please stop nagging on this matter.
There is no known support for your attitude in applicable standards
documents; nor in the Newsgroup FAQ.
Please also include in your own attributions sufficient material to put
the quoted material fully in context for those using off-line
newsreaders, when re-quoted in a further response.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Yvan J. Gagnon |
last post by:
I am currenly developing a web site using Macromedia fireworks, and am
trying to figure out a way (through hand-coding) of attaching a
javascript function (onClick="doit=false") to each of the links in my
fireworks-generated dhtml popup menus. Does anyone here know where I
would add this javascript fucntion in the code so that it would be
recognized? And do I do it in the html, or in the JS file?
The javascript function I need to add is...
|
by: David D. |
last post by:
Does the file extension matter when including a JavaScript file in an HTML
page?
Normally, one would include a JavaScript file in an HTML page using
<script src="foo.JS" type="text/javascript">
However, I have found that I can use an alternate file extension, such as
<script src="foo.HTML" type="text/javascript">
It works fine with my IE 6 and Mozilla. Will it work with other browsers?
|
by: TC |
last post by:
Hello,
I am using the script below to open a new window and once opened, redirect to that open window from the original window:
private void btnNewPDFWindow_Click(object sender, System.EventArgs e)
{
string NewPage = "NewPageZoom.aspx";
|
by: Slavo Smutny |
last post by:
Hi,
which is better approach to store my JavaScript code, to store it in
separate .js file
or to embed the code within HTML attributes (e.g. <p
onclick="javascript:submit();">click this</p>)?
I am interested in performance, i.e. how quick is page loaded in each case?
I think the better one is to store the code in separate .js file so that the
user browser can cache the file
(source: http://www.quirksmode.org/js/placejs.html#link1) but...
|
by: TastyKarma |
last post by:
Was hoping somebody might have experienced this before.
I have client-side javascript in my aspx files. For some reason when I
place the "debugger;" keyword in my javascript, Visual Studio no longer
breaks into the code. It used to, and I can't figure out what could
have changed to disable the feature.
1. My javascript code is definitely being called.
2. The "Disable Script Debugging" checkbox is cleared in my internet
settings (I've...
| |
by: kaston3 |
last post by:
I use screen.width to check escreen resolution and then document.write
to write different width tables accordingly. It all works OK with
Mozilla Firefox, however it seems that in IExplorer it only works when
I reload the page. I think it can be cache handling in IE.
I tried putting the javascript code in an extrenal js.file. Then i
tried calling that file with a random number (using time functions) eg.
mycode.js?nn=secondss; but it...
|
by: morgan.chengmo |
last post by:
Hi,
I am wandering whether all javascript code in one page is executed in
one thread. I know that javascript has no threading mechansim. No way
to tell which thread is running by code iteself.
For below code
<html>
<head>
</head>
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I protect my javascript code?
-----------------------------------------------------------------------
With clientside Javascript you can't as your code is distributed
in source form and is easily readable. With JScript, there is the
Script Encoder (see MSDN), but this is nothing more than obfuscation.
Disabling the right mouse button also does...
|
by: drhowarddrfine |
last post by:
When I visit this board, I see this frequently:
<script language=javascript>
but "language=javascript" was deprecated in 1996. So, why do people still use it? It doesn't do anything.
|
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...
|
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...
| |
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |