www.webdeveloper.com
Results 1 to 4 of 4

Thread: Image and Text Scripts. Is it possible?

Threaded View

  1. #1
    Join Date
    Apr 2014
    Posts
    2

    Lightbulb Image and Text Scripts. Is it possible?

    Hello.

    I have the following script in my webpage.:
    Code:
    <script type="text/javascript">
    	  function showImage(imgName) {
    		 document.getElementById('largeImg').src = imgName;
    		 showLargeImagePanel();
    		 unselectAll();
    	 }
    	 function showLargeImagePanel() {
    		 document.getElementById('largeImgPanel').style.visibility = 'visible';
    	 }
    	 function unselectAll() {
    		 if(document.selection) document.selection.empty();
    		 if(window.getSelection) window.getSelection().removeAllRanges();
    	 }
    	 function hideMe(obj) {
    		 obj.style.visibility = 'hidden';
    	 }
    </script>
    I call this script everytime I click on a certain image (in my case it's a thumbnail image). It just enlarges the image in middle of the webpage and when I click outside that image it closes it again.

    This is how I call the function:
    Code:
    <img src="1.JPG" style="cursor:pointer" onclick="showImage('1.JPG');" title="Title1"; />
    My question is: What can I add to the script so that I can add text to the image? For example, a box to it's side or underneath it that says the name of the photo a perhaps a small note that I can write and varies for different image. For example image1 title: title 1 note: I took this pic in my room. Etc.

    Sorry if the question is too trivial, I'm still a learner.

    Thank you for your time,
    E.
    Last edited by jedaisoul; 04-26-2014 at 12:19 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles