Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Write to excel

  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Write to excel

    Hi,
    I'm trying to do a web with images . And I want when the user click any of the images . Send/store the image location(X,Y) on the form the hight and the width to excel or .csv file.
    Or at least popup the information to the user.
    Help will be very appritiated.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Well you will need a form to write the the excel or csv file. You can get the XY values of the image by adding this in between your head tags
    Code:
    <script type="text/javascript">
    function setClick()
    {
    	var theimgs = document.getElementsByTagName('img');
    	for(var i = 0; i < theimgs.length; i++)
    	{
    		var el = theimgs[i];
    		el.onclick = function()
    		{
    			alert('The image with src="'+el.getAttribute('src')+'" is located at following coordinates:\nX = ' + el.offsetLeft + 'px\nY = ' + el.offsetTop + 'px');
    		}
    	}
    }
    window.onload = setClick;
    </script>
    Then just click on any image and you get the alert.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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