CodeLifter.com
S
oftware & S
cripts by CodeBrain.com
Home
JavaScripts
PopUp Maker
-
po
pup wind
ows
CodeLifter 5
-
source viewer
ScrollBar Styler
-
color scrol
lbars
Flash Fixer
-
rem
ove al
erts
Roll-Over Maker
-
image roll-overs
Link Cloaker 5
-
enc
rypt links
Site Capture 3
-
hidden frames
CHMOD 2 Utility
-
chmod utility
BlackBird 3.0
-
browser shell
Zoom 1.0
-
magnifier
MicroTicker.com
-
text scroller
CodeBrain.com
-
j
ava app
lets
BrainCode.com
-
j
ava app
lets
MailToProtector
-
protect email
Java Applets
Perl Scripts
Affiliate Program
Index
Access Image URL to TextBox
(Click on an image to show its address in the textbox)
Index
Image URL:
Clear
Click
here
to select the code in the window below.
Use Ctrl+C to copy it to your clipboard.
============================================================ Script: Access Image URL to TextBox Functions: When an image is clicked, this script will show the image URL in a textbox. Useful for cases where you want others to be able to copy the image address easily for linking... such as for banners, logo graphics, etc. A single instance of the script can be attached to any number of images in the page. Browsers: NS4-7, IE4 and later Author: etLux ============================================================ INSTRUCTIONS: Step One: The Script --------------------- Paste the following script into the <head> ... </head> of your page. There are no script set-ups needed. <script language="JavaScript"> // Script Source: CodeLifter.com // Copyright 2002 // Do not remove this notice var isReady = false; function showAddress(What){ if (isReady){ document.Which.Where.value = What; document.Which.Where.focus(); document.Which.Where.select(); }else{ alert("This page is not fully loaded yet...\nPlease wait for the page to finish loading."); } } function clearAddress(){ if (isReady){ document.Which.Where.value = ''; }else{ alert("This page is not fully loaded yet...\nPlease wait for the page to finish loading."); } } </script> Step Two: The Body Tag Onload Event ------------------------------------ Add onload="isReady=true" to your body tag, as shown below. This is necessary to prevent false object calls prior to the page being fully loaded. Thus: <body onload="isReady=true"> Step Three: The TextBox ------------------------- Insert the following code for the text box in your page. (It may be anywhere in your page.) Do not change the form or field names. <form name="Which"> <input type="text" size="60" name="Where"> </form> To clear the textbox from a link in the page, use this: <a href="#" onClick="clearAddress()"> Clear </a> Step Four: Attaching To The Images ----------------------------------- You may attach the script to as many images as you wish. To attach to the image add onMouseDown="showAddress(this.src)" to the img src tag, as shown in the sample below. <img src="http://site.com/image.gif" width="100" height="100" border="0" onMouseDown="showAddress(this.src)"> Note that you can use either the explicit http:// address of the image, or just a relative address to the image file. In the later case, it will still return the full http path to the image in the text box. ============================[end]===========================
Get The Code!
CodeLifter is a
CodeBrain.com
Sister Site
©1995 - 2012 OEC Corp & CodeLifter.com
CodeLifter™ & CodeBrain™
Legal Notices
CodeBrain InterNET Group
BrainCode.com
CodeFoot.com
CodeBelly.com
Droiddd.com
etLux.com
FFFast.com
TrayApps.com
PopUpWorks.com
MicroTicker.com
DavidSosnowski.com
OECCorp.com
MailToProtector.com
CodeBrain.com
Free MUSIC!
Contemporary classical music, completely free.