User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the RSS, Web Services and SOAP section within the Web Development category of DaniWeb, a massive community of 427,329 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,117 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our RSS, Web Services and SOAP advertiser: Programming Forums
Views: 3155 | Replies: 1
Reply
Join Date: Jan 2007
Posts: 3
Reputation: fray is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
fray fray is offline Offline
Newbie Poster

Mouse events, xml values and Javascript

  #1  
Jan 8th, 2007
I am wanting to replace the two values 560, 420 with two xml variables in the following code
<a href="#" onmouseover="zoom(560,420,'logo','in')" onmouseout="clearzoom()">Zoom Out</a>
I have tried the following without success:
<a href="#" onmouseover="zoom("<xsl:value-of select='imagesize/@width'/>","<xsl:value-of select='imagesize/@height'/>",'logo','in')" onmouseout="clearzoom()">Zoom In</a>
Zoom is a Javascript function in the xsl code - function zoom(originalW, originalH, what, state)
How do I substitute the two xml variables <xsl:value-of select='imagesize/@width'/> and <xsl:value-of select='imagesize/@height'/>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 964
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 48
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is online now Online
Posting Shark

Re: Mouse events, xml values and Javascript

  #2  
Jan 15th, 2007
you can't nest elements inside other element's attributes. what you'll need to do is either store the data in a variable and then use shorthand variable syntax in the attribute, or use the <xsl:attribute> tag.

Method #1 (by storing variables)
<xsl:variable name="winWidth"><xsl:value-of select='imagesize/@width'/></xsl:variable>
<xsl:variable name="winHeight"><xsl:value-of select='imagesize/@height'/></xsl:variable>

<a href="#" onmouseover="zoom('{$winWidth}','{$winHeight}','logo','in')" onmouseout="clearzoom()">Zoom In</a>

Method #2 (by <xsl:attribute>
<a href="#" onmouseout="clearzoom()">
<xsl:attribute name="onmouseover">
zoom('<xsl:value-of select='imagesize/@width'/>','<xsl:value-of select='imagesize/@height'/>','logo','in')
</xsl:attribute>
Zoom In
</a>

You shouldn't use double quotes inside doublequoted attributes =P
If it only works in Internet Explorer; it doesn't work.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb RSS, Web Services and SOAP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the RSS, Web Services and SOAP Forum

All times are GMT -4. The time now is 2:55 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC