←  Code Block

Fallout Studios Forums

»

[JS / HTML] Using extra object properties

Slightly Wonky Robob's Photo Slightly Wonky Robob 28 Jan 2008

How do you define / use extra object properties? For example, if i had something like this:

<div id=&#34;layer1&#34; property1=&#34;hi&#34;> </div>

How do i get this value with javascript? I've tried to return the value using something like this:

document.getElementById&#40;&#39;layer1&#39;&#41;.property1

But this returns undefined.. any ideas?
Quote

Felix Lockhart's Photo Felix Lockhart 29 Jan 2008

Is that even possible? I can't find any relevant information in DOM references. What are you trying to do with this?
Quote

Liliana's Photo Liliana 29 Jan 2008

The problem has already been resolved.

&#91;18&#58;37&#58;54&#93; <@Bob> anyhoo... http&#58;//forum.cncreneclips.com/index.php?showtopic=21064
&#91;18&#58;39&#58;22&#93; <+Guest63h> Bob&#58; I have the solution in my Turkmen script
&#91;18&#58;39&#58;26&#93; <+Guest63h> one moment...
&#91;18&#58;40&#58;30&#93; <+Guest63h> or no
&#91;18&#58;40&#58;31&#93; <+Guest63h> I don&#39;t
&#91;18&#58;40&#58;37&#93; <@Bob> D&#58;
&#91;18&#58;41&#58;49&#93; <+Guest63h> but
&#91;18&#58;41&#58;53&#93; <+Guest63h> it&#39;s possible
&#91;18&#58;42&#58;34&#93; <+Guest63h> getAttribute returns the value of a given attribute
&#91;18&#58;43&#58;06&#93; <+Guest63h> so you want
&#91;18&#58;43&#58;32&#93; <+Guest63h> document.getElementById&#40;&#39;layer1&#39;&#41;.getAttribute&#40;&#39;property1&#39;&#41;
&#91;18&#58;44&#58;06&#93; <@Bob> yeah, that works.. thanks &#58;D
&#91;18&#58;44&#58;12&#93; <@Bob> brb
Quote