Refreshing page changes the layout of UI - html

I am new to web development. I am using asp.net. Below is the CSS I use in a .aspx file. When I open it in my phone the UI looks fine although the #background is a little bit longer than the whole page.
<style type="text/css">
#form1 {
position: absolute;
z-index: 1;
}
#background {
position: absolute;
width: 100%;
height: 180%;
z-index: 0;
}
#Image1{
position:relative;
width:100%;
height:100%;
}
</style>
When I click the button, the UI refreshes to make the #background to be the same size as the whole page but extends the size of #Image1. Why does the refresh of page do this? How to avoid it? Thanks.
<div align="center">
<asp:Button ID="Reserve" runat="server" Width="800px" Text="Reserve" Font-Size="45px" BackColor="OrangeRed" ForeColor="White" OnClick="Reserve_Click"/>
</div>

Solved. The problem is in the back-end code
Response.Write("<script>alert(....)").
After changing it into
Page page=this.Page;
if (!page.ClientScript.IsStartupScriptRegistered(page.GetType(), "alert"))
{
page.ClientScript.RegisterStartupScript(page.GetType(), "alert", "<script>alert(....)");
}
the css is ok. referred from https://blog.csdn.net/woshixuye/article/details/7217261

Related

How to disable screen in HTML which block user interactions?

I dunno how exactly I can explain my issue or if the title is specific enough.
But what I want to do is for example I have a game like Tic Tac Toe and if the game finish a message should pop up the entire screen which block any other interactions except there is a button only.
Like that:
I think something with display: ???
Ive made a simple example for you how it could be done:
<head>
<style>
.content {
color: red;
}
.overlay {
z-index: 1;
width:100vw;
height: 100vh;
position: absolute;
top: 0;
left:0;
background-color:black;
opacity: 0.8;
}
.msg {
background-color: white;
width: 70px;
padding: 50px;
font-weight: bold;
text-align:center;
position: absolute;
top:40%;
left: 45%;
}
</style>
</head>
<body>
<p class="content">some content</p>
<div class=overlay>
<p class="msg">TEST</p>
</div>
</body>
</html>
this shows a black overlay over the complete Screen with a "TEST"-Message, you can add more Items like Buttons to the "overlay"-div if you want to.
But keep in mind, to use the "position: absolute;" attribute.
You can show or hide it by setting the "display: none" (hide) css-attribute to the "overlay"-div or setting "display: revert;" to show it
You need to create a fullscreen overlay.
Link: https://www.w3schools.com/howto/howto_js_fullscreen_overlay.asp
Then you can add a Javascript event so that your quiz restarts when the user clicks the restart button. Hope this helps!
You might want to look at this post, How can I disable an entire HTML page on an event like in the case of JavaScript alert? I found it just by searching your question on Google. You'll probably need to use jquery for the solution.

:target does not work on my site

I found cool css to create lightbox. It uses :target to show lightbox div. I tried in in code pen and it works fine, however on my site it doesn't show anything. I can't find what else in my code is blocking it from showing. Here's the basic code:
HTML:
<a href="#img2" class="image">
<img src="https://d2d00szk9na1qq.cloudfront.net/Product/2c6b113d-e972-42cc-a2de-f5dcf1c82e95/Images/Large_0297791.jpg">
</a>
<a href="#_" class="lightbox" id="img2">
<img src="https://d2d00szk9na1qq.cloudfront.net/Product/2c6b113d-e972-42cc-a2de-f5dcf1c82e95/Images/Large_0297791.jpg">
</a>`
CSS:
.lightbox {
display: none;
position: fixed;
z-index: 999;
width: 100%;
height: 100%;
text-align: center;
top: 0;
left: 0;
background: rgba(0,0,0,0.8)
}
.lightbox img {
max-width: 90%;
max-height: 80%;
margin-top: 2%;
}
.lightbox:target {
outline: none;
display: block;
}
(Codepen: http://codepen.io/anon/pen/jrBrmp)
and here's my site: http://test.fulfeal.co.uk/how-to/ Thanks in advance.
Aleksander
Something in your site installation is preventing the URL from changing when the hashtag links are clicked. The :target selector works on the hashtag in the URL.
You will see if you navigate directly to http://test.fulfeal.co.uk/how-to/#img1 the image pops up as expected. So nothing is wrong with your CSS, the issue is with the URL routing on your site.
In codepen the URL isn't changing because the demo box at the bottom has its own iframe, and it is being updated with the link.
Your site url is been routed. Two ways to solve the issue
You are using wordpress framework for your site, so go to the wordpress content admin panel and change your url type.
OR
Add below code at the end of your site.
<script>
$(function(){
$(".image").on("click",function(){
var image = $(this).attr("href");
$(image).show();
});
});
</script>

Streetview not rendering properly in firefox browser

Here is the fiddle i worked on http://jsfiddle.net/fyDkD/14/
My HTML is here
<div id="map-holder">
<div id="map_canvas" class="bigmap"></div>
<div id="map_stv" class="minimap" style="display:none"></div>
</div>
My CSS is here
#map-holder {
height: 1200px ;
position: relative;
}
.bigmap{
width:100%;
height:100%;
}
.minimap{
width:50%;
height:100%;
}
#map_stv {
position: absolute;
top: 0;
right: 0;
}
#map_stv img {
border: none !important;
max-width: none !important;
}
In this i see that when we drag and drop the pegman anywhere on the google map then we get the streetview. The street view is not proper only in Firefox browser. Also i have seen that if the difference between width and height is considerably large then we can see the issue very easily. The img of street view is not showing properly. Please suggest on this.
This can be fixed by adding
mode: 'html5'
to the panoramaOptions. I tested it and it works.
See Google's answer to this this bug report I sent them:
https://code.google.com/p/gmaps-api-issues/issues/detail?id=7246

Loading Image in GWT

I have been working on a project in GWT for which i need to show a loading image as like "Please Wait...".
I was able to fix this till page loads. But during history token changes, i cant show the same. I created a division as shown below,
<div id="loader">
<div id="loaderPanel">
</div>
<div id="loaderImage">
<div id="loaderText">
<b>Please Wait...</b>
</div>
<img src="images/loader.gif"/>
</div>
</div>
Also, here is my CSS
#loaderPanel {
background-color: white;
display: block;
height: 100%;
left: 0;
opacity: 0.8;
position: fixed;
top: 0;
width: 100%;
z-index: 1001;
}
#loaderImage {
background-color: transparent;
left: 48%;
position: fixed;
top: 48%;
z-index: 1002;
}
#loaderImage img{
height:22px;
margin-left:4px;
margin-top:0px;
width:119px;
}
#loaderText{
font-family:'Verdana';
font-weight:bold;
font-size:0.9em;
float:left;
}
This is the piece of code i used to make the DIV visible & invisible.
DOM.getElementById("loader").getStyle().setDisplay(Display.NONE);
DOM.getElementById("loader").getStyle().setDisplay(Display.BLOCK);
Can anyone please suggest me a better way to show a loading GIF image for History Changes?
YOu should implement HistoryListener and show the gif when the onModuleLoad() method is called:
http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/History.html
I got the Answer,
It was not showing the Loading Image because the execution locally was much faster. But when it comes to production mode, i found that, it is showing a loading image for a while.
Since my client strictly needs to show the loader, he suggested me to add a small delay. So i added the delay inside a Timer Scheduled. By the time it shows the loader, i did the Pre-Fetching of the Images and other objects used in the page.
So i mark my question as Closed...

Creating a full screen iframe

I'm currently looking into XSS attacks, with the aim of using them in client demonstrations (I'm a pen tester). I've written a tool that will host a malicious version of a website's login page (that harvests usernames and passwords) and then redirects the victim back to the original website. However, I have been trying to get it to work using iframes instead, as it would look far more convincing as the url won't change.
I've googled about and this seems to be the appropriate code:
<iframe src="http://192.168.0.1/login.php" style="border: 0; width: 100%; height: 100%">
but the iframe created is by no means full screen (on internet explorer and firefox). Here is a screenshot
As you can see, the iframe login page is beneath the "what is your name?" area, thus no where near full screen. I've tried editing the css file of the malicious login page, to include full screen parameters, but this has no effect either.
Does anyone have any solutions? Thanks!
Not tested, but try this:
<iframe src="http://192.168.0.1/login.php" style="border: 0; position:absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%">
or
<iframe src="http://192.168.0.1/login.php" style="border: 0; position:fixed; top:0; left:0; right:0; bottom:0; width:100%; height:100%">
This code works:
<html>
<head>
<style type="text/css">
body
{
margin: 0;
overflow: hidden;
}
#iframe1
{
height: 100%;
left: 0px;
position: absolute;
top: 0px;
width: 100%;
}
</style>
</head>
<body>
<iframe id="iframe1" src="HERE PLACE YOUR URL" frameborder="0"></iframe>
</body>
</html>