Loading ...
Sorry, an error occurred while loading the content.

how to access param values

Expand Messages
  • ztminhas
    Hi, I have to figure out something pretty soon so I would appreciate your assistance. I have a SVG file which needs to display some data from a server or a
    Message 1 of 2 , Nov 6, 2007
    • 0 Attachment
      Hi,

      I have to figure out something pretty soon so I would appreciate your
      assistance. I have a SVG file which needs to display some data from a
      server or a local server side variable, or from a java script variable.
      I would like to know if it is possible to use the param tag to
      accomplish this:


      <object type="image/svg+xml" id="svgdocHead" data="embfiles/head.svg"
      width="599px" height="55px">
      <param name="src" value="embfiles/head.svg">
      <param name="left" value="100"/>
      <param name="right" value="500"/>
      </object>

      where the values in the param tag could indicate some kind of values
      that the svg could read, in manner very similar to how an applet can
      read param values.

      If there is a way to accomplish this, could you please let me know? I am
      even willing to pay for the help, so send me your account numbers! :-)

      Best Regards

      Zafar T Minhas



      [Non-text portions of this message have been removed]
    • Doug Schepers
      Hi, Zafar- This is the sort of thing that s covered in the CDF Working Group s new WICD specs. I ve got an example on my site. [1] To pass parameters to an
      Message 2 of 2 , Nov 6, 2007
      • 0 Attachment
        Hi, Zafar-

        This is the sort of thing that's covered in the CDF Working Group's new
        WICD specs. I've got an example on my site. [1]

        To pass parameters to an SVG, use the <object> element with child
        <param> elements. Each <param> element should have name/value pairs with
        the 'name' and 'value' attributes; these will be exposed to the embedded
        SVG document. The actual values are not necessarily specified, and can
        be arbitrary strings, though there are a few formal parameter
        name/values. An example of the HTML markup is:

        <object type="image/svg+xml" data="embeddedDoc.svg">
        <param name="color" value="orange" />
        <param name="label" value="some text" />
        </object>


        The code for the script to access these parameterized values in the
        embedded SVG might look like this:

        var params =
        document.defaultView.frameElement.getElementsByTagName('param');
        for ( var i = 0, iLen = params.length; iLen > i; i++ )
        {
        var eachParam = params[ i ];
        var name = eachParam.getAttribute( 'name' );
        var value = eachParam.getAttribute( 'value' );
        //do something here with the values;
        }

        My bank account number is... ;)


        [1] http://www.schepers.cc/examples/pass-params.html


        Regards-
        -Doug

        ztminhas wrote (on 11/6/2007 7:02 AM):
        > Hi,
        >
        > I have to figure out something pretty soon so I would appreciate your
        > assistance. I have a SVG file which needs to display some data from a
        > server or a local server side variable, or from a java script variable.
        > I would like to know if it is possible to use the param tag to
        > accomplish this:
        >
        >
        > <object type="image/svg+xml" id="svgdocHead" data="embfiles/head.svg"
        > width="599px" height="55px">
        > <param name="src" value="embfiles/head.svg">
        > <param name="left" value="100"/>
        > <param name="right" value="500"/>
        > </object>
        >
        > where the values in the param tag could indicate some kind of values
        > that the svg could read, in manner very similar to how an applet can
        > read param values.
        >
        > If there is a way to accomplish this, could you please let me know? I am
        > even willing to pay for the help, so send me your account numbers! :-)
        >
        > Best Regards
        >
        > Zafar T Minhas
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.