evt's [Archive] - XML Elves

evt's

Anonymous
06-17-2004, 01:34 PM
I was looking at this example using events (code at the bottom) and it works.
I try to use it in another html file with checkboxes, and it doesn't work. I tried to have the checkbox call a function and pass in the checkbox and evt. Upon loading I get an error "evt not defined" or something to that effect. When can you use evt?

================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg contentScriptType="text/ecmascript" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" version="1.0">

<script>

function fill_rects(evt, color)
{
nodes = evt.currentTarget.getElementsByTagName("rect");
for(i=0; i!=nodes.length; i++) // strangely does not work with "smaller than"
nodes.item(i).setAttributeNS(null,'fill',color);

}
</script>

<g onmouseover="fill_rects(evt,'yellow')" onmouseout="fill_rects(evt,'red')" fill="red">
<rect x="20" y="330" width="150" height="100"/>
<rect x="200" y="330" width="150" height="100"/>
<rect x="380" y="330" width="150" height="100"/>
</g>

</svg>

Anonymous
06-19-2004, 01:08 AM
evt is only defined in svg !

You must change function if you put it in html

function fill_rects( color)
{
nodes = document.YourEmbedName.getSVGDocument().firstChild .getElementsByTagName("rect");
for(i=0; i!=nodes.length; i++) // strangely does not work with "smaller than"
nodes.item(i).setAttributeNS(null,'fill',color);
}


Michel

Anonymous
06-21-2004, 11:19 AM
Thanks Michel,
Is there a reference that lists all the functions?
And explains the tree? ie how many nodes there are and what each node is?

Anonymous
06-22-2004, 12:44 AM
For functions about objects, look at
http://www.learnsvg.com/tutorial2/catalog.php

For nodes see our first tutorial
http://www.learnsvg.com/tutorials/index.php

Michel

Many examples also on my site
http://pilat.free.fr/english

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum