You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ma...@swisscom.com on 2003/05/01 13:54:32 UTC

XSP : integrate javascript

Is there an easy way to insert javascript on buttons (like OnClick or
OnMouseOver actions) into an XSP page?

thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: XSP : integrate javascript

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Joerg Heinicke dijo:
> 1. IMHO this has nothing to do in the XSP. XSP is on the generator level
>  and should not care about view handling.

Yes, I agree but this is just one idea of how get it work. I tought he
needed to include some javascripts for some events. This is just one
example.
>
> 2. It can be simplified to <xsl:copy-of select="@onchange"/>.

Thanks, for the tip :-)

Antonio Galardo
>
> Joerg
>
> Antonio Gallardo wrote:
>>>Is there an easy way to insert javascript on buttons (like OnClick or
>>> OnMouseOver actions) into an XSP page?
>>
>> Yes, you can use XSL that can helps you to do that.
>>
>> For example: here is a tag <text> that can be used to define a textbox
>>
>> <xsl:template match="text">
>>   <input type="text" name="{@name}" size="{@size}" value="{@value}">
>>     <xsl:if test="@onchange"> <!-- If there is onchange, add it! -->
>>       <xsl:attribute name="onChange">
>>         <xsl:value-of select="@onchange"/></xsl:attribute>
>>       </xsl:if>
>>     </input>
>>   </xsl:template>
>>
>> Usage from a XSP:
>>
>> <text name="id" size="10" value=""
>>   onchange="my_func(var1, var 2)">
>> </text>
>>
>> Best Regards,
>>
>> Antonio Gallardo
>>
>>>thanks
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: XSP : integrate javascript

Posted by Joerg Heinicke <jo...@gmx.de>.
1. IMHO this has nothing to do in the XSP. XSP is on the generator level 
and should not care about view handling.

2. It can be simplified to <xsl:copy-of select="@onchange"/>.

Joerg

Antonio Gallardo wrote:
>>Is there an easy way to insert javascript on buttons (like OnClick or
>>OnMouseOver actions) into an XSP page?
> 
> Yes, you can use XSL that can helps you to do that.
> 
> For example: here is a tag <text> that can be used to define a textbox
> 
> <xsl:template match="text">
>   <input type="text" name="{@name}" size="{@size}" value="{@value}">
>     <xsl:if test="@onchange"> <!-- If there is onchange, add it! -->
>       <xsl:attribute name="onChange">
>         <xsl:value-of select="@onchange"/></xsl:attribute>
>       </xsl:if>
>     </input>
>   </xsl:template>
> 
> Usage from a XSP:
> 
> <text name="id" size="10" value=""
>   onchange="my_func(var1, var 2)">
> </text>
> 
> Best Regards,
> 
> Antonio Gallardo
> 
>>thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: XSP : integrate javascript

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
> Is there an easy way to insert javascript on buttons (like OnClick or
> OnMouseOver actions) into an XSP page?

Yes, you can use XSL that can helps you to do that.

For example: here is a tag <text> that can be used to define a textbox

<xsl:template match="text">
  <input type="text" name="{@name}" size="{@size}" value="{@value}">
    <xsl:if test="@onchange"> <!-- If there is onchange, add it! -->
      <xsl:attribute name="onChange">
        <xsl:value-of select="@onchange"/></xsl:attribute>
      </xsl:if>
    </input>
  </xsl:template>

Usage from a XSP:

<text name="id" size="10" value=""
  onchange="my_func(var1, var 2)">
</text>

Best Regards,

Antonio Gallardo
>
> thanks
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: XSP : integrate javascript

Posted by Stavros Kounis <go...@osmosis.gr>.
put your javascript code in external .js files
and then insert .js file in your .xsp just like in .html

-- stavros

On Thu, 1 May 2003 Maxime.Gheysen@swisscom.com wrote:

> Is there an easy way to insert javascript on buttons (like OnClick or
> OnMouseOver actions) into an XSP page?
>
> thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org