Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. applying image on the border of message box created using javascript

applying image on the border of message box created using javascript

Scheduled Pinned Locked Moved ASP.NET
javascriptdebuggingtoolsarchitecturehelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sanket Patil
    wrote on last edited by
    #1

    Hi I have written one javascript function to create messagebox using div. The script is given below. function showBox(str) { debugger; var width = document.documentElement.clientWidth + document.documentElement.scrollLeft; var layer = document.createElement('div'); layer.style.zIndex = 2; layer.id = 'layer'; layer.style.position = 'absolute'; layer.style.top = '0px'; layer.style.left = '0px'; layer.style.height = document.documentElement.scrollHeight + 'px'; layer.style.width = width + 'px'; layer.style.backgroundColor = 'LightGray'; layer.style.opacity = '.7'; layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=80)"); document.body.appendChild(layer); var div = document.createElement('div'); div.style.zIndex = 3; div.id = 'box'; div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed'; //div.style.border==" " div.style.top = '200px'; div.style.left = (width / 2) - (400 / 2) + 'px'; div.style.height = '100px'; div.style.width = '400px'; div.style.backgroundColor = 'White'; div.style.border = '4px solid silver'; div.style.padding = '20px'; document.body.appendChild(div); var myimg = document.createElement('IMG'); myimg.src= "../images3.jpg"; myimg.width= '50'; myimg.height = '50'; myimg.visible="true"; div.appendChild(myimg); var p = document.createElement('p'); p.innerHTML = str; p.style.position = "absolute"; p.style.top = '20px'; p.style.fontSize=14+'px'; p.style.fontWeight = "bold"; p.style.left = (width / 2) - (800 / 2) + 'px'; div.appendChild(p); var btn=document.createElement('Button'); btn.innerHTML='Ok'; btn.style.border='2px solid silver'; btn.style.opacity = '.6'; btn.style.fontSize=16+'px'; btn.style.fontWeight = "bold"; btn.style.border='solid'; btn.style.position = "absolute"; btn.style.top = '100px'; btn.style.left = (width / 2) - (620 / 2) + 'px'; btn.onclick = function() { document.body.removeChild(document.getElementById('layer')); document.body.removeChild(document.getElementById('box')); }; div.appendChild(btn); } I dont have any problem in this script. The only problem i have is , I am unable to apply image of round corner to the border of that message box. Does anybody has solution for my problem. How ca

    C R 2 Replies Last reply
    0
    • S Sanket Patil

      Hi I have written one javascript function to create messagebox using div. The script is given below. function showBox(str) { debugger; var width = document.documentElement.clientWidth + document.documentElement.scrollLeft; var layer = document.createElement('div'); layer.style.zIndex = 2; layer.id = 'layer'; layer.style.position = 'absolute'; layer.style.top = '0px'; layer.style.left = '0px'; layer.style.height = document.documentElement.scrollHeight + 'px'; layer.style.width = width + 'px'; layer.style.backgroundColor = 'LightGray'; layer.style.opacity = '.7'; layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=80)"); document.body.appendChild(layer); var div = document.createElement('div'); div.style.zIndex = 3; div.id = 'box'; div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed'; //div.style.border==" " div.style.top = '200px'; div.style.left = (width / 2) - (400 / 2) + 'px'; div.style.height = '100px'; div.style.width = '400px'; div.style.backgroundColor = 'White'; div.style.border = '4px solid silver'; div.style.padding = '20px'; document.body.appendChild(div); var myimg = document.createElement('IMG'); myimg.src= "../images3.jpg"; myimg.width= '50'; myimg.height = '50'; myimg.visible="true"; div.appendChild(myimg); var p = document.createElement('p'); p.innerHTML = str; p.style.position = "absolute"; p.style.top = '20px'; p.style.fontSize=14+'px'; p.style.fontWeight = "bold"; p.style.left = (width / 2) - (800 / 2) + 'px'; div.appendChild(p); var btn=document.createElement('Button'); btn.innerHTML='Ok'; btn.style.border='2px solid silver'; btn.style.opacity = '.6'; btn.style.fontSize=16+'px'; btn.style.fontWeight = "bold"; btn.style.border='solid'; btn.style.position = "absolute"; btn.style.top = '100px'; btn.style.left = (width / 2) - (620 / 2) + 'px'; btn.onclick = function() { document.body.removeChild(document.getElementById('layer')); document.body.removeChild(document.getElementById('box')); }; div.appendChild(btn); } I dont have any problem in this script. The only problem i have is , I am unable to apply image of round corner to the border of that message box. Does anybody has solution for my problem. How ca

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The obvious issue is, for you to have a rounded corner, the bit that's meant to be rounded off, needs to look the same as the form underneath. Unless you're able to use PNGs and the browser respects their transparency, I don't see how this could work.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      1 Reply Last reply
      0
      • S Sanket Patil

        Hi I have written one javascript function to create messagebox using div. The script is given below. function showBox(str) { debugger; var width = document.documentElement.clientWidth + document.documentElement.scrollLeft; var layer = document.createElement('div'); layer.style.zIndex = 2; layer.id = 'layer'; layer.style.position = 'absolute'; layer.style.top = '0px'; layer.style.left = '0px'; layer.style.height = document.documentElement.scrollHeight + 'px'; layer.style.width = width + 'px'; layer.style.backgroundColor = 'LightGray'; layer.style.opacity = '.7'; layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=80)"); document.body.appendChild(layer); var div = document.createElement('div'); div.style.zIndex = 3; div.id = 'box'; div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed'; //div.style.border==" " div.style.top = '200px'; div.style.left = (width / 2) - (400 / 2) + 'px'; div.style.height = '100px'; div.style.width = '400px'; div.style.backgroundColor = 'White'; div.style.border = '4px solid silver'; div.style.padding = '20px'; document.body.appendChild(div); var myimg = document.createElement('IMG'); myimg.src= "../images3.jpg"; myimg.width= '50'; myimg.height = '50'; myimg.visible="true"; div.appendChild(myimg); var p = document.createElement('p'); p.innerHTML = str; p.style.position = "absolute"; p.style.top = '20px'; p.style.fontSize=14+'px'; p.style.fontWeight = "bold"; p.style.left = (width / 2) - (800 / 2) + 'px'; div.appendChild(p); var btn=document.createElement('Button'); btn.innerHTML='Ok'; btn.style.border='2px solid silver'; btn.style.opacity = '.6'; btn.style.fontSize=16+'px'; btn.style.fontWeight = "bold"; btn.style.border='solid'; btn.style.position = "absolute"; btn.style.top = '100px'; btn.style.left = (width / 2) - (620 / 2) + 'px'; btn.onclick = function() { document.body.removeChild(document.getElementById('layer')); document.body.removeChild(document.getElementById('box')); }; div.appendChild(btn); } I dont have any problem in this script. The only problem i have is , I am unable to apply image of round corner to the border of that message box. Does anybody has solution for my problem. How ca

        R Offline
        R Offline
        rupamroy
        wrote on last edited by
        #3

        Apply PNG file to set corner rounded :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups