Hi Travsam,
As an answer to your question, many things are wrong in your
script: where are the end marks of the command lines(;) ?
What is: d1.visibility("hidden") ? This is not an ecmascript command!
I undeststand that this is your mid-term project, so you have to
pick up a book from the library of your college, and first learn how
to code ecma-script for SVG.
In the SVG coding, you have everything inside <defs>....</defs>,
where are the <use>....</use> ? You have also to learn SVG! You can
use the same book for both.
Good luck with YOUR project, Samy
--- In [email protected], "jucabapa79" <[EMAIL PROTECTED]>
wrote:
> Well, for begin this, I could first refer for the code i made for
> show the dice results. This is not running properly when i test it
> in the computer, it don't shows anything. What's wrong?
>
> Greetings
>
> Travsam
>
> -------------------------This is the code--------------------------
> <?xml version="1.0"?>
>
>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG
> 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> <svg width="500px" height="500px" viewBox="0 0 500 500">
> <script language="text/ecmasscript">
> <![CDATA[
> /** Configures the dice according to a six number's random select.
> It should change the visibility status of one or two of four
> different SVG objects forming dice forms.
> The default number is 1, the visibility will change depending
> of the number, cases of number 3 and 5 will be
> made over combinations of forms two and four combinations
with
> the one combination.
> */
> function throwdice(){
> //create a random integer between 0 and 5
> var randomDice=Math.round(Math.random()*5)
> dice = randomDice
> switch (dice)
> {
>
> case 1:
> d1.visibility("hidden")
> d2.visibility("visible")
> d4.visibility("hidden")
> d6.visibility("hidden")
> break
> case 2:
> d1.visibility("visible")
> d2.visibility("visible")
> d4.visibility("hidden")
> d6.visibility("hidden")
> break
> case 3:
> d1.visibility("hidden")
> d2.visibility("hidden")
> d4.visibility("visible")
> d6.visibility("hidden")
> break
> case 4:
> d1.visibility("visible")
> d2.visibility("hidden")
> d4.visibility("visible")
> d6.visibility("hidden")
> break
> case 5:
> d1.visibility("hidden")
> d2.visibility("hidden")
> d4.visibility("hidden")
> d6.visibility("visible")
> break
> default:
> d1.visibility("visible")
> d2.visibility("hidden")
> d4.visibility("hidden")
> d6.visibility("hidden")
> break
> }
> }
> ]]>
>
> </script>
> <!-- creating the dice pictures, as I refered, the forms are based
> in dice forms, there are not
> three and five forms because it was based on combinations of one
and
> other combination (It means, five
> will be made combining four and one combination and three will be
> made combining two and one). Also
> there is the button that can throw the dice-->
> <defs>
> <g onclick="throwDice();">
> <rect x="70" y="10" width="60" height="20" rx="4" ry="4"
> style="fill: #ddd;"/>
> <text x="100" y="25" style="text-anchor:
> middle;">Throw</text>
> </g>
> <g id="d6" visibility="hidden">
> <rect x="50" y="50" height="100" width="100" style="stroke:
> black; fill: none;"/>
> <circle cx="125" cy="125" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="75" cy="75" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="125" cy="75" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="75" cy="125" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="75" cy="100" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="125" cy="100" r="10" style="stroke: none; fill:
> blue;"/>
> </g>
> <g id="d1" visibility="visible">
> <rect x="50" y="50" height="100" width="100" style="stroke:
> black; fill: none;"/>
> <circle cx="100" cy="100" r="10" style="stroke: none; fill:
> blue;"/>
> </g>
> <g id="d2" visibility="hidden">
> <rect x="50" y="50" height="100" width="100" style="stroke:
> black; fill: none;"/>
> <circle cx="125" cy="125" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="75" cy="75" r="10" style="stroke: none; fill:
> blue;"/>
> </g>
> <g id="d4" visibility="hidden">
> <rect x="50" y="50" height="100" width="100" style="stroke:
> black; fill: none;"/>
> <circle cx="125" cy="125" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="75" cy="75" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="125" cy="75" r="10" style="stroke: none; fill:
> blue;"/>
> <circle cx="75" cy="125" r="10" style="stroke: none; fill:
> blue;"/>
> </g>
> </defs>
> </svg>
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/