show = 'text' + num --> show = eval('text' + num)
Chris Lemon wrote:
> why don't you put the 4 pieces of text into an array then use the
> "source.value" to index into it
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 19 March 2001 12:21
> To: [EMAIL PROTECTED]
> Subject: [Dynapi-Help] how to make setHtml use variable?
>
> Can't I use a variable in setHtml()?
> Or - what am I doing wrong?
> The eventlistener returns the number of the headline just fine, but when
> trying
> to put the variable in setHtml() to show text1-4 depending on which headline
> I
> mouseover, in the textLayer I just see "text1" or "text2" etc, it doesn't
> show
> me the contents of the variables.
>
> Thankful for help, here's the code:
>
> <script language="Javascript" src="../src/dynapi.js"></script>
> <script language="Javascript">
> DynAPI.setLibraryPath('../src/lib/')
> DynAPI.include('dynapi.api.*')
> DynAPI.include("dynapi.gui.label.js")
> DynAPI.include("dynapi.gui.list.js")
> </script>
> <script language="Javascript">
> DynAPI.onLoad = function() {
>
> textLayer=new DynLayer(null,290,258,180,185,'#c0c0c0')
> list = new List()
> list.moveTo(21,95)
> list.setWidth(260)
> list.boldOnSelect(true)
> list.add("headline 1",1)
> list.add("headline 2",2)
> list.add("headline 3",3)
> list.add("headline 4",4)
>
> var text1 = "some text"
> var text2 = "some new text"
> var text3 = "some other text"
> var text4 = "some old text"
>
> var myListener = new EventListener()
> myListener.onmouseover = function(e) {
> source = e.getSource()
> source.setBgColor('white')
> num = source.value
> show = 'text' + num
> textLayer.setHTML(show)
> }
> myListener.onmouseout=function(e) {
> source=e.getSource()
> source.setBgColor('silver')
> }
> list.items[0].addEventListener(myListener)
> DynAPI.document.addChild(list)
> DynAPI.document.addChild(textLayer)
> }
> </script>
>
> /Jesper Bierbum
>
> _______________________________________________
> 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
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help
Re: [Dynapi-Help] how to make setHtml use variable?
Jordi - IlMaestro - Ministral Mon, 19 Mar 2001 05:33:16 -0800
- [Dynapi-Help] how to make setHtml use variab... jesper . bierbum
- Re: [Dynapi-Help] how to make setHtml u... Doug Melvin
- RE: [Dynapi-Help] how to make setHtml u... Chris Lemon
- RE: [Dynapi-Help] how to make setHt... Cameron Hart
- Jordi - IlMaestro - Ministral
