| 1 |
<?xml version="1.0" standalone="no"?> |
| 2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" |
| 3 |
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd"> |
| 4 |
|
| 5 |
<!-- |
| 6 |
|
| 7 |
Licensed to the Apache Software Foundation (ASF) under one or more |
| 8 |
contributor license agreements. See the NOTICE file distributed with |
| 9 |
this work for additional information regarding copyright ownership. |
| 10 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
| 11 |
(the "License"); you may not use this file except in compliance with |
| 12 |
the License. You may obtain a copy of the License at |
| 13 |
|
| 14 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 15 |
|
| 16 |
Unless required by applicable law or agreed to in writing, software |
| 17 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 18 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 |
See the License for the specific language governing permissions and |
| 20 |
limitations under the License. |
| 21 |
|
| 22 |
--> |
| 23 |
<!-- ====================================================================== --> |
| 24 |
<!-- Modification of a rect's attributes --> |
| 25 |
<!-- --> |
| 26 |
<!-- @author [email protected] --> |
| 27 |
<!-- @version $Id$ --> |
| 28 |
<!-- ====================================================================== --> |
| 29 |
|
| 30 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 31 |
|
| 32 |
<svg id="body" width="450" height="500" viewBox="0 0 450 500"> |
| 33 |
<title><rect> attributes 'onload'</title> |
| 34 |
|
| 35 |
<text x="50%" y="45" class="title"><rect> attributes in 'onload'</text> |
| 36 |
|
| 37 |
<script type="text/ecmascript"> |
| 38 |
|
| 39 |
function initRect(evt, x, y, w, h, rx, ry) { |
| 40 |
var elt = evt.target; |
| 41 |
elt.setAttribute("x", x) |
| 42 |
elt.setAttribute("y", y) |
| 43 |
elt.setAttribute("width", w) |
| 44 |
elt.setAttribute("height", h) |
| 45 |
if (rx != null) { |
| 46 |
elt.setAttribute("rx", rx) |
| 47 |
} |
| 48 |
if (ry != null) { |
| 49 |
elt.setAttribute("ry", ry) |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
</script> |
| 54 |
|
| 55 |
<g id="test-content"> |
| 56 |
|
| 57 |
<rect width="1" height="1" style="fill:orange" |
| 58 |
onload="initRect(evt, 50, 80, 150, 100)" /> |
| 59 |
|
| 60 |
<rect width="1" height="1" style="fill:crimson" |
| 61 |
onload="initRect(evt, 250, 80, 150, 100, 20)" /> |
| 62 |
|
| 63 |
<rect width="1" height="1" style="fill:gold" |
| 64 |
onload="initRect(evt, 50, 230, '33%', 150, 20, 40)" /> |
| 65 |
|
| 66 |
<rect width="1" height="1" style="fill:#eee" |
| 67 |
onload="initRect(evt, 250, 230, '33%', '150px', '16.5%', 75)" /> |
| 68 |
|
| 69 |
|
| 70 |
<g style="stroke:black; fill:none; stroke-width:2"> |
| 71 |
<rect x="50" y="80" width="150" height="100" /> |
| 72 |
<rect x="250" y="80" width="150" height="100" rx="20" /> |
| 73 |
<rect x="50" y="230" width="33%" height="150" rx="20" ry="40" /> |
| 74 |
<rect x="250" y="230" width="33%" height="150px" rx="16.5%" ry="75" /> |
| 75 |
</g> |
| 76 |
|
| 77 |
<g style="fill:black; stroke:none; text-anchor:middle"> |
| 78 |
<text x="125" y="200" >x, y, width, height</text> |
| 79 |
<text x="325" y="200" >x, y, width, height, rx</text> |
| 80 |
<text x="125" y="400" >x, y, width, height, rx, ry</text> |
| 81 |
<text x="325" y="400" >x, y, width, height, rx, ry (units and %)</text> |
| 82 |
</g> |
| 83 |
</g> |
| 84 |
</svg> |