Jump to content

My first post.... How to build an Box...


Nightfly

Recommended Posts

Dear Community.

 

I want to build a windows to place an link inside it, but if i press the "X" the window must disapear/close, the near example is this on google, so, can anyone tell me the code to build an window like this one used on google??

 

window.jpg

 

Anyone can help?????

 

 

Best Regards

João Carrolo

Link to comment
https://forums.phpfreaks.com/topic/281215-my-first-post-how-to-build-an-box/
Share on other sites

[This isn't a PHP issue, moving post to the JavaScript forum]

 

It is most likely just a DIV. Inside that div there is the X element with an onclick trigger attached to it which calls a javascript function to change the display property of the div so it doesn't display.

 

Here is a very ROUGH example script

<html>
<head>
<script type="text/javascript">

function closeDiv(divID)
{
    document.getElementById(divID).style.display = 'none';
}

</script>
</head>
<body>
This is some random content on the page
<br><br>

<div id="dialog" style="width:200px; border: 1px solid black;padding: 3px;">
    <div style="text-align:right;" onclick="closeDiv('dialog');">X</div>
    <div style="padding:10px;">Click the 'X;' to close this dialog<br><br></div>
</div>

This is some other random content on the page

</body>
</html>

That's the point - it is an example. It is up to you to build it however you want it to look. Or, if you want to get really fancy you can use the JQuery UI: http://jqueryui.com/dialog/

 

But, that also requires YOU to actually do some work and you would have to know something about coding in JavaScript to get it working appropriately. If you are just wanting someone to code this for you, then I can move your post to the freelance forum.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.