document.styleSheets[0].rules[7].style.margin-top = "200";
Thanks for your help.
Don
>In article <timstreater-C27E...@news.individual.net>,
> Tim Streater <timst...@waitrose.com> wrote:
>
>> In article <1tb6569c4mgtojagn...@4ax.com>,
>By the way that's not a hyphen. It's a minus sign which is why JS is
>bleating.
I thought a "minus-sign" had the same character-code as a "hyphen".
>In article <1tb6569c4mgtojagn...@4ax.com>,
> Don <n...@adr.com> wrote:
>
>If you google for margin-top you'll probably find a site that tells you
>the equivalence between the CSS atttribute and the JavaScript
>equivalent. Such as:
>
>document.styleSheets[0].rules[7].style.marginTop = 200 + "px";
That works! I've spent the past hour on this, googling and experimenting. I thought I tried "marginTop", but maybe I didn't. Some days are just a bear!
Thanks, for your help Tim. I appreciate it!
Don
Just to avert confusion, it's a minus sign that works in CSS and a
hyphen character would work for neither.
>In article <n4d656p1rncc97o07...@4ax.com>,
>I mean to say that JS knows nothing about hyphens and plenty about
>minus-signs.
>
>:-)
Okay. Thanks to all for your help.
Don
> I thought a "minus-sign" had the same character-code as a "hyphen".
In javascript, if it's not in quotes, it's a minus sign.
If it is in quotes, you can call it minus or hyphen or dash or whatever
else you like.
Rgds
Denis McMahon
than you need a crash-course in Google:
http://lmgtfy.com/?q=css+margin+top+javascript&l=1
1st link is going to:
http://www.w3schools.com/css/pr_margin-top.asp
and there's the info about "margintop".......
--
Luuk
<snip>
>>By the way that's not a hyphen. It's a minus sign which is why JS is
>>bleating.
> I thought a "minus-sign" had the same character-code as a "hyphen".
No. ASCII has a minus sign. A hyphen is longer and ASCII doesn't have
one.
John
--
John Harris
> I thought a "minus-sign" had the same character-code as a "hyphen".
Far from it. Check http://www.cs.tut.fi/~jkorpela/dashes.html
for more info.
Hans-Georg
> On Fri, 30 Jul 2010 at 13:23:38, in comp.lang.javascript, Don wrote:
>> On Fri, 30 Jul 2010 21:16:42 +0100, Tim Streater
>
> <snip>
>>> By the way that's not a hyphen. It's a minus sign which is why JS is
>>> bleating.
>> I thought a "minus-sign" had the same character-code as a "hyphen".
>
> No. ASCII has a minus sign.
I have actually bought and read the ASCII standard (ANSI INCITS 4-1986), so
I know what I'm talking about. It has a character with the primary name
HYPHEN and the alternate name MINUS SIGN. In Unicode, this character is
called HYPHEN-MINUS to reflect its semantic ambiguity: it is used as a
hyphen, as a minus sign, as an en dash, as en em dash, and for other
purposes. Unicode additionally encodes, in different positions, the
unambiguous (or at least less ambiguous) characters HYPHEN and MINUS SIGN,
but in ASCII, you cannot make such a distinction.
Of course, in JavaScript and relatives, as in most programming languages,
the ASCII HYPHEN character has, by definition, the semantics of a minus sign
when used in an arithmetic expression. But this relates to the "higher level
protocol", the language definition, and not to character-level issues.
> A hyphen is longer and ASCII doesn't have one.
Wrong. ASCII has HYPHEN just as well as it has MINUS SIGN, or more (since
HYPHEN is the primary name). When a distinction is made between a hyphen and
a minus sign, the minus sign is surely longer. The length (width) of ASCII
HYPHEN varies by font, since its design may reflect the primary use as a
hyphen, where it should be fairly short by typographic tradition, or the
ambiguous semantics (so that the length is between the length of a
typographically suitable hyphen and the length of a typographically suitable
minus sign or en dash or em dash).
--
Yucca, http://www.cs.tut.fi/~jkorpela/
>
>I mean to say that JS knows nothing about hyphens and plenty about
>minus-signs.
IIRC, without checking at www.unicode.org, Unicode has a character
position for minus and another for hyphen. Computer programmers and
most typists use neither of those, but use \x2D which is generated by a
keyboard key directly.
--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 7.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
DOS/Win/UNIX now 2.0.6; see <URL:http://www.merlyn.demon.co.uk/pc-links.htm>.
But as the author is right here, you might as well ask him
directly. (:-)
Hans-Georg