I think all the style changes you want to make can be done on a label, then
just us setText('blah').
See this example:
http://www.richardinfo.f2s.com/dynapi/Richard_Examples/Label_Properties_Exam
ple.html
(url wraps)
On the otherhand your example should work just fine, simply leave out the
double-quotes ("), and it works ns4/ie.
Like this:
<INPUT TYPE="text" size="37" name="myInput"VALUE=""
onchange="test.setHTML('<div valign=center style=text-align: $alignment;
font-size: 30px; line-height: 0px; font-family: Courier><font face=Courier
color=#00FFFF><b><i>' + form.field.value + '</i></b></font></div>');">
Cheers,
Richard Bennett
[EMAIL PROTECTED]
www.richardinfo.com
(Everything running on, and ported to DynAPI2.51)
visit the DynAPI homepage (and FAQ) ::
http://dynapi.sourceforge.net/dynapi/index.php?menu=1
Browse (and search) the mailinglist here:
http://www.mail-archive.com/index.php3?hunt=dynapi
----- Original Message -----
From: "Kristina Pfaff-Harris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 27, 2001 7:09 PM
Subject: [Dynapi-Help] onChange in form calling setHTML()
>
> Hi, all. This may actually be more of an HTML/Javascript question rather
> than a dynapi question: if so, please feel free to refer me to "tfm" so I
> can "r" it. :)
>
> I have defined a layer and used myLayer.setHTML() with a quite long
> string including <div>, style tags for font, and some text, like this:
>
> myLayer.setHTML('<div valign="center" style=" text-align: $alignment;
> font-size: 30px; line-height: 0px; font-family: Courier"><font
> face="Courier" color="#00FFFF"><b><i>Some Text</i></b></font></div>')
>
> (I need all that style info because the layers need to emulate what would
> be printed on a printer fairly closely, and this is about the only way I
> can do it.) This works great for setting up the layer. But here's the
> problem: In the main document, I have a form, e.g:
>
> <form name=myForm action="blahblah.cgi">
> Name: <input type=text name=Name value="Something">
> </form>
>
> The idea is that when they type something into that input slot, it
> automatically updates the text part of the HTML in the layer. Now, in the
> input field, I've put:
>
> onChange="myLayer.setHTML('<the same html>' + myForm.Name.value + '</the
> same html>?');"
>
> What I want to happen is that when they change the text in the field, it
> updates *just* the text part of the HTML in the layer, but keeps all the
> style and font information in the layer display. However, while I can
> assign the HTML fine in the beginning, I have problems using onChange in
> the form field because of the "" in the "style=" line for the setHTML tag.
> If I keep the "" around the style tag, it becomes an unterminated string.
> If I use " or " for the quotes around the style tag, it does not
> error, and changes the layer, but loses all the style information. If I
> just backslash the quotes, of course that doesn't work either, but I
> thought I'd try it anyway. :)
>
> The only other thing I could think of was maybe to do something like this:
> at the beginning of DynAPI.onLoad=function ():
>
> myLefthtml = '<html with all the style stuff>';
> myRighthtml = '</html with all the style stuff>';
>
> then do something like
>
> onChange="myLayer.setHTML(myLefthtml + form.field.value + myRighthtml);"
>
> This works in IE, but not NS4 (in NS4, it changes the text string, but
> again loses all the style information). Thanks for any info...I may just
> be stuck with this. I believe this may just be the nature of the beast
> with HTML and Javascript, but wondered if anyone had ever encountered this
> or found a workaround?
>
> Kristina
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help