Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8090 > unrolled thread

multi browser forms issue

Started byDizzee <slightlyandy@gmail.com>
First post2011-11-06 14:07 -0800
Last post2011-11-11 23:38 +0100
Articles 14 — 6 participants

Back to article view | Back to comp.lang.javascript


Contents

  multi browser forms issue Dizzee <slightlyandy@gmail.com> - 2011-11-06 14:07 -0800
    Re: multi browser forms issue Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-06 22:38 +0000
    Re: multi browser forms issue David Mark <dmark.cinsoft@gmail.com> - 2011-11-07 04:40 -0800
      Re: multi browser forms issue Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-07 14:01 +0100
        Re: multi browser forms issue Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-07 14:13 +0100
          Re: multi browser forms issue Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-07 14:58 +0100
            Re: multi browser forms issue Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-07 15:51 +0100
        Re: multi browser forms issue "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-11-07 16:08 +0200
        Re: multi browser forms issue David Mark <dmark.cinsoft@gmail.com> - 2011-11-07 13:05 -0800
          Re: multi browser forms issue Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-07 23:07 +0100
            Re: multi browser forms issue Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-07 23:26 +0100
              Re: multi browser forms issue Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-09 20:17 +0100
                Re: multi browser forms issue Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-10 18:42 +0100
                  Re: multi browser forms issue Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-11 23:38 +0100

#8090 — multi browser forms issue

FromDizzee <slightlyandy@gmail.com>
Date2011-11-06 14:07 -0800
Subjectmulti browser forms issue
Message-ID<a9622d31-d06a-4886-8a6d-b90e8a1781ef@o19g2000vbk.googlegroups.com>
I'm baffled...
how can I make a simple button multi browser compatible.. or at least
the top 5 browsers....
thank you

<?php
echo date("H:i:s");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Button Test</title>
</head>
<script type="text/javascript">
function b_changeImage()
{
document.images["BigButton"].src= "big_button_purple_over.png";
return true;
}
function b_changeImageBack()
{
 document.images["BigButton"].src = "big_button_purple.png";
 return true;
}
function b_handleMDown()
{
	document.images["BigButton"].src = "big_button_white.png";
	return true;
}
function b_handleMUp()
{
	b_changeImage();
	return true;
}

function formSubmit()
 {
	 alert("clicked");
 document.getElementById("dataform").submit();
 }


</script>
<body>


<form name="dataform" method="post" action="button.php">
	<input type="text" name="one"  id="one" value="who won">
	<br>
	<input type="text" name="two" id="two" value="you too">
	<br>
	<input type="text" name="three" id="three" value="three dom">
	<br>
	<input type="text" name="four" id="four" value="go forth">
</form>

    <A href="javascript:formSubmit()" onMouseOver="return
b_changeImage()" onMouseOut= "return b_changeImageBack()"
onMouseDown="return b_handleMDown()" onMouseUp="return
b_handleMUp()"><img id="BigButton" src="images/big_button_purple.png"
class="bigbutt" alt="Big Button"></A>

	<?php
	echo "<br>";
	foreach ($_POST as $key => $value) {
		echo "$key => $value<br>\n";
		}
	?>
    </body>


</html>

[toc] | [next] | [standalone]


#8091

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2011-11-06 22:38 +0000
Message-ID<4eb70c5f$0$28521$a8266bb1@newsreader.readnews.com>
In reply to#8090
On Sun, 06 Nov 2011 14:07:33 -0800, Dizzee wrote:

> I'm baffled...

So am I, what is your javascript problem?

i.e. what code does not do what you expect in which browser?

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#8102

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2011-11-07 04:40 -0800
Message-ID<6b248eda-8b2d-4618-af26-d3983cdcdbb1@u10g2000prl.googlegroups.com>
In reply to#8090
On Nov 6, 5:07 pm, Dizzee <slightlya...@gmail.com> wrote:
> I'm baffled...
> how can I make a simple button multi browser compatible.. or at least
> the top 5 browsers....

And what is an acceptable outcome for browsers other than your
personal top 5?

> thank you
>
> <?php
> echo date("H:i:s");
> ?>

Don't post server side code in a client side example. View the source
in your browser and post the relevant portion.

> <!DOCTYPE HTML>

Why are you using HTML5? Many browsers in use (e.g. most versions of
IE) don't know what it is. And seeing as multi-browser consistency is
eluding you...

> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

That's not right for HTML5.

> <title>Button Test</title>
> </head>
> <script type="text/javascript">
> function b_changeImage()
> {
> document.images["BigButton"].src= "big_button_purple_over.png";
> return true;}
>
> function b_changeImageBack()
> {
>  document.images["BigButton"].src = "big_button_purple.png";
>  return true;}
>
> function b_handleMDown()
> {
>         document.images["BigButton"].src = "big_button_white.png";
>         return true;}
>
> function b_handleMUp()
> {
>         b_changeImage();
>         return true;
>
> }
>
> function formSubmit()
>  {
>          alert("clicked");
>  document.getElementById("dataform").submit();

This looks like it is going down a wrong path. A click listener that
submits the form? How about a submit listener on the form and let the
browser handle the details of when to submit?

And that "dataform" element has no ID. As I'm sure you have found, IE
(among others) doesn't doesn't care. Most other browsers do as gEBI is
not supposed to return elements without ID's.

>  }
>
> </script>
> <body>
>
> <form name="dataform" method="post" action="button.php">
>         <input type="text" name="one"  id="one" value="who won">
>         <br>
>         <input type="text" name="two" id="two" value="you too">
>         <br>
>         <input type="text" name="three" id="three" value="three dom">
>         <br>
>         <input type="text" name="four" id="four" value="go forth">
> </form>
>
>     <A href="javascript:formSubmit()" onMouseOver="return
> b_changeImage()" onMouseOut= "return b_changeImageBack()"
> onMouseDown="return b_handleMDown()" onMouseUp="return
> b_handleMUp()"><img id="BigButton" src="images/big_button_purple.png"
> class="bigbutt" alt="Big Button"></A>

That's not a button at all, which is your main problem. You want an
input (type "submit" or "image") here, not a link. You certainly don't
want a link that requires scripting. Trying to fake the submit button
breaks all sorts of functionality as well (e.g. submitting the form by
hitting enter in a text input).

Can't see why you need script for this at all. Can use CSS
(e.g. :hover, :focus, :active) to change the background image of the
submit button. I assume you planned to put some sort of validation in
the click listener, but such code belongs in a submit listener.

[toc] | [prev] | [next] | [standalone]


#8103

FromEric Bednarz <bednarz@fahr-zur-hoelle.org>
Date2011-11-07 14:01 +0100
Message-ID<m2y5vsnl21.fsf@nntp.bednarz.nl>
In reply to#8102
David Mark <dmark.cinsoft@gmail.com> writes:

>> <!DOCTYPE HTML>
>
> Why are you using HTML5?

That’s not ‘using HTML5’, that’s choosing a rendering mode in a mnemonic
fashion, and without the cargo cult parts that do nothing.

> Many browsers in use (e.g. most versions of
> IE) don't know what it is. And seeing as multi-browser consistency is
> eluding you...

Many (besides academical experiments, I'd say all) browsers don’t know
what SGML is, still lots of websites try to look like (parts of) SGML
documents.

Having said that, the above document type declaration meets the SGML
production for ‘document type declaration’. Go figure.

>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>
> That's not right for HTML5.

There seem to be quite some things eluding you, too…

[toc] | [prev] | [next] | [standalone]


#8104

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-11-07 14:13 +0100
Message-ID<1924605.C0IIP4dKs2@PointedEars.de>
In reply to#8103
Eric Bednarz wrote:

> David Mark <dmark.cinsoft@gmail.com> writes:
>>> <!DOCTYPE HTML>
>> Why are you using HTML5?
> 
> That’s not ‘using HTML5’, that’s choosing a rendering mode in a mnemonic
> fashion, and without the cargo cult parts that do nothing.

Incorrect.  There is a difference in rendering between using a DOCTYPE 
declaration without a public identifier (as here), a DOCTYPE declaration 
containing only a public identifier, and a DOCTYPE declaration containing 
both a public and a system identifier.  Therefore, "using HTML5" is nothing 
more than a proper, if colloquial, synonym for the first part of your 
definition.

>> Many browsers in use (e.g. most versions of IE) don't know what it is.
>> And seeing as multi-browser consistency is eluding you...
> 
> Many (besides academical experiments, I'd say all) browsers don’t know
> what SGML is, still lots of websites try to look like (parts of) SGML
> documents.

The DOCTYPE declaration matters for various reasons that appear to elude 
you.

> Having said that, the above document type declaration meets the SGML
> production for ‘document type declaration’. Go figure.

You should have provided some proof of your assertion, such as 
<http://www.w3.org/MarkUp/SGML/productions.html>

But HTML5 is not SGML-based.


PointedEars
-- 
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
  -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>

[toc] | [prev] | [next] | [standalone]


#8105

FromEric Bednarz <bednarz@fahr-zur-hoelle.org>
Date2011-11-07 14:58 +0100
Message-ID<m2ty6gniew.fsf@nntp.bednarz.nl>
In reply to#8104
Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:

> Eric Bednarz wrote:
>
>> David Mark <dmark.cinsoft@gmail.com> writes:
>>>> <!DOCTYPE HTML>
>>> Why are you using HTML5?
>> 
>> That’s not ‘using HTML5’, that’s choosing a rendering mode in a mnemonic
>> fashion, and without the cargo cult parts that do nothing.
>
> Incorrect.  There is a difference in rendering between using a DOCTYPE 
> declaration without a public identifier (as here), a DOCTYPE declaration 
> containing only a public identifier, and a DOCTYPE declaration containing 
> both a public and a system identifier.

“You should have provided some proof of your assertion, such as” an
example of an external identifier that is expected to set rendering to
‘standards compatibility’ (e.g. system and public identifier for HTML
4.01) and results in a different ‘standards compatibility’ than your
“proper, if colloquial, synonym” for HTML5 does.

[toc] | [prev] | [next] | [standalone]


#8108

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-11-07 15:51 +0100
Message-ID<2334260.bKofY8J0qe@PointedEars.de>
In reply to#8105
Eric Bednarz wrote in comp.lang.javascript:

> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>> Eric Bednarz wrote:
>>> David Mark <dmark.cinsoft@gmail.com> writes:
>>>>> <!DOCTYPE HTML>
>>>> Why are you using HTML5?
>>> That’s not ‘using HTML5’, that’s choosing a rendering mode in a mnemonic
>>> fashion, and without the cargo cult parts that do nothing.
>> Incorrect.  There is a difference in rendering between using a DOCTYPE
>> declaration without a public identifier (as here), a DOCTYPE declaration
>> containing only a public identifier, and a DOCTYPE declaration containing
>> both a public and a system identifier.
> 
> “You should have provided some proof of your assertion, such as” an
> example of an external identifier that is expected to set rendering to
> ‘standards compatibility’ (e.g. system and public identifier for HTML
> 4.01) and results in a different ‘standards compatibility’ than your
> “proper, if colloquial, synonym” for HTML5 does.

Generally known facts, such as the existence of Standards, Almost Standards, 
and Quirks Mode, and the different DOCTYPE declarations that do and do not 
trigger them, do not require reference (in particular not here, where those 
are rather well-known basics).  I have also provided enough information so 
that your statement can be easily falsified.

FWIW: <http://hsivonen.iki.fi/doctype/>, referred by 
<http://www.quirksmode.org/css/quirksmode.html>, provides a good overview.  
What appears to be missing from that article is the case of the omitted 
system identifier, but that is easily demonstrated, and explained at, e. g., 
<https://developer.mozilla.org/en/Mozilla's_DOCTYPE_sniffing>.


X-Post & F'up2 ciwam

PointedEars
-- 
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
  -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>

[toc] | [prev] | [next] | [standalone]


#8107

From"Jukka K. Korpela" <jkorpela@cs.tut.fi>
Date2011-11-07 16:08 +0200
Message-ID<j98onv$lpt$1@dont-email.me>
In reply to#8103
11/7/2011 3:01 PM, Eric Bednarz wrote:

>>> <!DOCTYPE HTML>
>>
>> Why are you using HTML5?
>
> That’s not ‘using HTML5’,

It depends on what you mean by ‘using HTML5’. It’s a vague expression, 
and not just because ‘HTML5’ is vague.

> that’s choosing a rendering mode in a mnemonic
> fashion, and without the cargo cult parts that do nothing.

It also has the effect of putting some HTML linters to a mode where they 
perform a mixture of checks based on some understanding of some version 
of HTML5, as opposite to performing markup validation that reports 
reportable markup errors (an SGML concept that you surely know but most 
participants don’t; the resident troll is either very ignorant or 
pretends to be very ignorant, as usual).

While HTML5 linters, misleadingly called ‘validators’ in HTML5 drafts 
are all experimental and with loads of bugs and without a reasonable 
description of what they actually do, they are often more useful than 
markup validators. Markup validation was never meant to be anything more 
than a formal check of markup for syntactic correctness and conformance 
to a DTD – though it has often been advertised as an overall quality check.

The JavaScript aspect here is that – contrary to many people’s 
misconceptions – markup validators do not perform any kind of check of 
JavaScript code. It’s just character data to them, parsed by applicable 
parsing rules, paying attention only to certain formal issues that 
relate to the potentially markup-significant characters ‘&’ and ‘<’. But 
HTML linters may do all kinds of things.

An HTML linter might well check e.g. href attribute values, embedded CSS 
code, and JavaScript code. It might call a JavaScript linter and/or 
perform its own checks, which might relate to specific HTML constructs.

In practice, I don’t think the current HTML5 linters inspect JavaScript 
code much. But they have tried to do such things. There was an incident 
where an HTML5 linter gave strange error messages about event attributes 
containing return statements. I don’t know what the idea really was, but 
there are many _possibilities_ for doing something useful, though it 
would need to be right in order to be useful.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

[toc] | [prev] | [next] | [standalone]


#8109

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2011-11-07 13:05 -0800
Message-ID<858f3485-5cf5-41f1-b4be-e8619d3ac867@k38g2000pro.googlegroups.com>
In reply to#8103
On Nov 7, 8:01 am, Eric Bednarz <bedn...@fahr-zur-hoelle.org> wrote:
> David Mark <dmark.cins...@gmail.com> writes:
> >> <!DOCTYPE HTML>
>
> > Why are you using HTML5?
>
> That’s not ‘using HTML5’, that’s choosing a rendering mode in a mnemonic
> fashion, and without the cargo cult parts that do nothing.

What else could it possibly mean, except this person intends to use
HTML5 markup (or is just copying and pasting patterns). Yes, I know
what the doctype does and I can't imagine why anybody would transplant
an HTML5 doctype onto a document that fits squarely into HTML4.

>
> > Many browsers in use (e.g. most versions of
> > IE) don't know what it is. And seeing as multi-browser consistency is
> > eluding you...
>
> Many (besides academical experiments, I'd say all) browsers don’t know
> what SGML is, still lots of websites try to look like (parts of) SGML
> documents.
>
> Having said that, the above document type declaration meets the SGML
> production for ‘document type declaration’. Go figure.

So what? It's still stupid to use that doctype at this time (unless
you actually intend to use HTML5 markup). I don't care is "all
browsers" avoid quirks mode with that one.

Of course, as most Web developers used to label their tag soup XHTML
transitional, this new trend could be considered an improvement.

>
> >> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>
> > That's not right for HTML5.
>
> There seem to be quite some things eluding you, too…

Wrong. Once again, I am pointing out how silly it is to transplant an
HTML5 doctype onto a document that is clearly not HTML5.

[toc] | [prev] | [next] | [standalone]


#8113

FromEric Bednarz <bednarz@fahr-zur-hoelle.org>
Date2011-11-07 23:07 +0100
Message-ID<m2mxc7mvs3.fsf@nntp.bednarz.nl>
In reply to#8109
David Mark <dmark.cinsoft@gmail.com> writes:

> Eric Bednarz wrote:

>>>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>>
>>> That's not right for HTML5.
>>
>> There seem to be quite some things eluding you, too…
>
> Wrong. Once again, I am pointing out how silly it is to transplant an
> HTML5 doctype onto a document that is clearly not HTML5.

By making bullshit statements? Oh well. I guess you win :-)

[toc] | [prev] | [next] | [standalone]


#8114

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-11-07 23:26 +0100
Message-ID<9716086.hkaJUJhadI@PointedEars.de>
In reply to#8113
Eric Bednarz wrote:

> David Mark <dmark.cinsoft@gmail.com> writes:
>> Eric Bednarz wrote:
>>>>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>>>>
>>>> That's not right for HTML5.
>>>
>>> There seem to be quite some things eluding you, too…
>>
>> Wrong. Once again, I am pointing out how silly it is to transplant an
>> HTML5 doctype onto a document that is clearly not HTML5.
> 
> By making bullshit statements? Oh well. I guess you win :-)

There are two ways to approach this problem.  One, to assume HTML5 was 
intended and some things in the document need to be fixed to make that Valid 
HTML5.  Two, to assume HTML5 was not intended and some sort of "cargo cult" 
that you have been talking about earlier made the author believe that this 
was the way to do things.

Given the fact that in this document the `script' element resides between 
`head' and `body' element, and that it contains attempts, with
javascript:-URI driven scripting in place of a submit button, to submit a 
form by ID that has only a name specified, what do you think is the more 
reasonable approach here?


PointedEars
-- 
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

[toc] | [prev] | [next] | [standalone]


#8178

FromEric Bednarz <bednarz@fahr-zur-hoelle.org>
Date2011-11-09 20:17 +0100
Message-ID<m2ehxh14ww.fsf@nntp.bednarz.nl>
In reply to#8114
Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:

> Eric Bednarz wrote:
>
>> David Mark <dmark.cinsoft@gmail.com> writes:
>>> Eric Bednarz wrote:
>>>>>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>>>>>
>>>>> That's not right for HTML5.
>>>>
>>>> There seem to be quite some things eluding you, too…
>>>
>>> Wrong. Once again, I am pointing out how silly it is to transplant an
>>> HTML5 doctype onto a document that is clearly not HTML5.
>> 
>> By making bullshit statements? Oh well. I guess you win :-)
>
> There are two ways to approach this problem.

Possibly. For me, however, there is but one. I comment exactly on what I
quote and call shenanigans when appropriate.

[toc] | [prev] | [next] | [standalone]


#8204

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-11-10 18:42 +0100
Message-ID<1481913.n2Sy7kCIUo@PointedEars.de>
In reply to#8178
Eric Bednarz wrote:

> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>> Eric Bednarz wrote:
>>> David Mark <dmark.cinsoft@gmail.com> writes:
>>>> Eric Bednarz wrote:
>>>>>>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>>>>>> That's not right for HTML5.
>>>>> There seem to be quite some things eluding you, too…
>>>> Wrong. Once again, I am pointing out how silly it is to transplant an
>>>> HTML5 doctype onto a document that is clearly not HTML5.
>>> By making bullshit statements? Oh well. I guess you win :-)
>> There are two ways to approach this problem.
> 
> Possibly. For me, however, there is but one. I comment exactly on what I
> quote and call shenanigans when appropriate.

Ignoring the context of a statement and then attacking the person making the 
statement (instead of the statement) on those grounds constitutes a number 
of common fallacies.

HTML5 was declared (with what is known as "doctype" per the current HTML5 
Working Draft), but was evidently not used in the rest of the document.  
Calling a statement that points this out a "bullshit statement" is 
inappropriate by any reasonable measure.


PointedEars
-- 
When all you know is jQuery, every problem looks $olvable.

[toc] | [prev] | [next] | [standalone]


#8245

FromEric Bednarz <bednarz@fahr-zur-hoelle.org>
Date2011-11-11 23:38 +0100
Message-ID<m2vcqqffob.fsf@nntp.bednarz.nl>
In reply to#8204
Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:

> Eric Bednarz wrote:
>
>> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>>> Eric Bednarz wrote:
>>>> David Mark <dmark.cinsoft@gmail.com> writes:
>>>>> Eric Bednarz wrote:
>>>>>>>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>>>>>>> That's not right for HTML5.
>>>>>> There seem to be quite some things eluding you, too…
>>>>> Wrong. Once again, I am pointing out how silly it is to transplant an
>>>>> HTML5 doctype onto a document that is clearly not HTML5.
>>>> By making bullshit statements? Oh well. I guess you win :-)
>>> There are two ways to approach this problem.
>> 
>> Possibly. For me, however, there is but one. I comment exactly on what I
>> quote and call shenanigans when appropriate.
>
> Ignoring the context

Look who’s talking.

> of a statement and then attacking the person making the 
> statement (instead of the statement) on those grounds constitutes a number 
> of common fallacies.

I agree. So why do you do that?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web