need help on "value"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Demoso

    need help on "value"

    Hi

    What's wrong with this line:

    document.write( '<input style="width: 260px;" type="button"
    id="button2" onmouseover="mo ver(\'button2\' ,\'green\');"
    onmouseout="mov er(\'button2\', color2);" value ='+txt6+'
    onClick="SetCoo kie(\'modem\'); this.value=txt7 ";>')

    txt6 is 4 words long, but only the first word in the string will show.

  • Lasse Reichstein Nielsen

    #2
    Re: need help on &quot;value&quo t;

    Demoso <> writes:
    [color=blue]
    > Hi
    >
    > What's wrong with this line:
    >
    > document.write( '<input style="width: 260px;" type="button"
    > id="button2" onmouseover="mo ver(\'button2\' ,\'green\');"
    > onmouseout="mov er(\'button2\', color2);" value ='+txt6+'
    > onClick="SetCoo kie(\'modem\'); this.value=txt7 ";>')
    >
    > txt6 is 4 words long, but only the first word in the string will show.[/color]

    You must put quotes around attribute values that contain spaces. You
    should put them around all attribute values. In your case, if txt6
    is "Some random four words", then you write this HTML:
    <input .... value =Some random four words onClick= ... >
    The browser has no way of knowing that "random" isn't a value-less
    attribute.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...