SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2004
    0 Post(s)
    0 Thread(s)

    xslt and javascript

    Ok, my problem is this. I'm trying to do a mouseonover event that will change the background color, underline the text, and change the image next to it. I've gotten 2/3 done but the last 1/3 is giving me trouble, and that's changing the image scr. I've been working on it for about two days on and off and basically ran out of ideas. In the code posted below I took out the function on onMouseOver for the background change and underline. I'm just working on the image right now and moved that from the function to the code here. Any ideas would be great. Thanks!!

    HTML Code:
    <table width="100%" id="links" valign="top" cellSpacing="0" cellPadding="0">
    			<xsl:for-each select="Links">
    					<td width="80%" height="18" valign="left" onMouseOut="cellout(this)">						
    						<xsl:attribute name="class">
    							<xsl:value-of select="@class"/>
    						<xsl:attribute name="onMouseOver">
    							document.'<xsl:value-of select="@name"/>'.scr='../Icons/spacer.gif'
    						<IMG src="../Icons/spacer.gif" width="5" align="middle"></IMG>
    						<IMG src="../Icons/ico.gif" align="middle">
    							<xsl:attribute name="NAME">
    								<xsl:value-of select="@name"/>
    						<IMG src="../Icons/spacer.gif" width="10" align="middle"></IMG>					
    						<xsl:attribute name="onclick">
    							window.location.href='<xsl:value-of select="@link" />'
    						<xsl:value-of select="@title" />						

  2. #2
    SitePoint Guru hgilbert's Avatar
    Join Date
    Dec 2004
    0 Post(s)
    0 Thread(s)
    try using the DOM object.
    have ID for the images
    and use document.getElementByID("img1").
    (and then code the rest ie .src = "image.jpg" or .style.underline = "true")
    is a safer way of doing.

    make sure you tag the images with ID - if you are aiming for XHTML W3C
    otherwise you can carry on with document.images['img1'] if you go for the <image name="img1"> style.

    I think putting IDs is the first thing you need - the rest will come easier.
    hope this helps.
    Last edited by hgilbert; Dec 19, 2004 at 13:33.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts