Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <form method="POST" name="dynamicselector">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="178">
        <tr>
          <td width="35%" valign="top" align="left"><select name="dynamicselector2" size="4"
          onChange="generateimage(this.options[this.selectedIndex].value)">
            <option value="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-plane-128.png">Car</option>
            <option value="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-plane-128.png">Pool ball</option>
            <option value="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-plane-128.png">Plane</option>
            <option value="../hand.gif">Hand</option>
            <option value="cake.gif">Pie</option>
          </select><!--webbot bot="HTMLMarkup" startspan --><script>

/*
Dynamic Image selector Script- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

function findcoordinates(){
if (window.temp1)
return
temp1=document.all.dynamicimage.offsetLeft
temp2=document.all.dynamicimage.offsetTop
currentobj=document.all.dynamicimage.offsetParent
             
while (currentobj.tagName!="BODY"){
temp1+=currentobj.offsetLeft
temp2+=currentobj.offsetTop
currentobj=currentobj.offsetParent
}
}

function generateimage(which){
if (document){
//dynamic3.innerHTML='<center>Loading image...</center>'
dynamic3.innerHTML+='<img id="dynamicimage" src="'+which+'" class="drag"><br>'
findcoordinates()
}
else if (document.layers){
document.dynamic1.document.dynamic2.document.write('<img src="'+which+'">')
document.dynamic1.document.dynamic2.document.close()
}
else
alert('You need NS 4 or IE 4 to view the images!')
}
</script>
<!--webbot bot="HTMLMarkup" endspan
          --></td>
          <td width="65%" valign="top" align="left"><ilayer id="dynamic1" width=100% height=178><layer id="dynamic2" width=100% height=178><div id="dynamic3">
</div></layer></ilayer></td>
        </tr>
      </table>
    </form>
              
            
!

CSS

              
                .drag{position:absolute;cursor:hand}

              
            
!

JS

              
                /*
Dynamic image selector with drag n drop Script- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

var dragapproved=false
var z,x,y
function move(){

if (event.which==1&&dragapproved){
   console.log(z)
   z.style.left=(temp1+event.clientX-x)  + 'px';
z.style.top=(temp2+event.clientY-y) + 'px';
return false
}
}
function drags(){
//if (!document.all)
 // return
if (event.srcElement.className=="drag"){
dragapproved=true
z=event.srcElement
x=event.clientX
y=event.clientY
document.onmousemove=move
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
//-->

              
            
!
999px

Console