Insert data in Date Field of Webpage - javascript

HTML code Whole Page
<html><head><title>BOSS</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE8; IE=EmulateIE9; IE=EmulateIE10; IE=EmulateIE11; ">
<meta name="robots" content="noindex">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="/stocks/jsp/SURVEILLANCE/css/style.css">
<link rel="stylesheet" type="text/css" href="/stocks/jsp/SURVEILLANCE/css/ddsmoothmenu.css">
<link rel="stylesheet" type="text/css" href="/stocks/jsp/SURVEILLANCE/css/MenuPage.css">
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/scripts/jquery12/jquery-3.2.1.js"></script>
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/scripts/jquery12/jquery-ui.js"></script>
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/scripts/ddsmoothmenu.js"></script>
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/scripts/clock.js"></script>
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/scripts/IframeStatus.js"></script>
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/scripts/tableEffects.js"></script>
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/validate.js"></script>
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/scripts/Commonall.js"></script>
<script type="text/javascript" src="/stocks/jsp/SURVEILLANCE/scripts/MenuPage.js"></script>
<script type="text/javascript">
var gLoginKey ='1633328062-01022071071078';
var gLoginId ='103';
function ShowMenus(pAppId)
{
frmMain.AppId.value = pAppId;
frmMain.submit();
return;
}
function logout(e)
{
location.assign("/stocks/Logout?LoginKey=" + gLoginKey+ "&LoginId="+gLoginId+"&ScrId=0-100000000");
}
/*function loginLog()
{
parent.frames['frmmainsurv'].location.href="/stocks/LoginLog?LoginKey=" + gLoginKey+ "&LoginId="+gLoginId;
return;
}
*/
function ChangePwd()
{
var w=window.open("/stocks/jsp/SURVEILLANCE/password.jsp?LoginKey=" + gLoginKey+ "&LoginId="+gLoginId+"&ScrId=0-100000005",'window1','scrollbars=yes,resizable=no,width=300,height=200');
}
function handleKey1(pEvent)
{
if(pEvent.keyCode == 116)
{
pEvent.keyCode=0;
pEvent.returnValue=false;
pEvent.cancelBubble=true;
}
}
function Reload()
{
frmMain.AppId.value="-1";
frmMain.submit();
}
function modelesswin(url,mwidth,mheight){
var mLeft=screen.width-200;
var mTop=screen.height-200;
if (document.all&&window.print) //if ie5
eval('window.showModelessDialog(url,"BSELINK","help:0;resizable:0;scrollbars:0;dialogTop='+mTop+';dialogLeft='+mLeft+';dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")');
else
eval('window.open(url,"BSELINK","width='+mwidth+'px,height='+mheight+'px,resizable=0,scrollbars=0")');
}
// added by nitish.kadam for check browser name.
$(function(){
var browserName = navigator.appName;
if("Microsoft Internet Explorer"==browserName){
$('#middle').css('margin-top',"10px");
}
else{
$('#middle').css('margin-top',"0px");
$('#footerDetails').css('margin-top',"-10px");
}
});
</script>
<style type="text/css">
#header, #footer, #middle {
width: 100%;
left: 0;
}
#middle {
/* top: 75px;
bottom: 30px;
overflow: auto ;*/
top: 63px;
position: fixed;
overflow: auto;
/* height: 550px; */
width:99%;
background: white;
/* border: solid #fe770f 1px; */
border-radius: 8px;
margin-left: 3px;
margin-top: 0px;
height: 88%;
clear:both;
z-index: 10;
}
#header {
/* height: 80px; */
height: 10%;
top: 0;
/* background:black; */
border:0x solid #666;
color: white;
}
#footer {
position: absolute;
height: 2%;
bottom: 0;
/* background:black; */
border:0px solid #666;
color: black;
}
#element1 {display:inline-block;}
#element2 {display:inline-block;}
#footerTdId1{
width: 1%;
}
#footerTdId2{
width: 90%;
}
iframe#frmmainsurv {
width: 100% !important;
}
</style>
</head>
<body oncontextmenu="return true;" style="height: 100%;overflow:hidden;width:100%"><!--Height added-->
<div id="header "> <!-- added by nitish -->
<table border="0" cellspacing="0" cellpadding="0" style="width:100%">
<tbody><tr>
<td align="center" width="20%">
<a href="#" onclick="javascript:Reload();">
<img src="/stocks/jsp/SURVEILLANCE/images/eboss.gif" height="55" border="0" alt="" style="z-index:-1">
</a>
</td>
<td align="left">
<div>
<div id="smoothmenu1" class="ddsmoothmenu" style="display:inline-block;">
<ul>
<li style="z-index: 100;">Alerts & Events<img src="/stocks/jsp/SURVEILLANCE/images/down.gif" class="downarrowclass" style="border:0;"><ul style="top: 30px; visibility: visible; left: 0px; width: 237px; display: none;"><li>News Announcements</li><li style="z-index: 99;">Member Surveillance Alerts<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="top: 0px; visibility: visible; left: 237px; width: 237px; display: none;"><li>Regulatory</li><li style="z-index: 98;">Exchange<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="top: 0px; visibility: visible; left: 237px; width: 237px; display: none;"><li>Equity</li><li>Derivative</li><li>Currency</li><li>Commodity</li></ul></li><li>Member Regulatory Alert Response Upload</li></ul></li><li>Inspection And Compliance Checklist</li><li>Workflow Statistics</li><li>Dynamic Price Band Scrips</li><li>Realtime News</li><li style="z-index: 97;">Member Dashboard<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="display: none; top: 0px; visibility: visible;"><li>Equity/Derivatives</li><li>Currency</li><li>Commodity</li></ul></li></ul></li><li style="z-index: 96;">Member Mis<img src="/stocks/jsp/SURVEILLANCE/images/down.gif" class="downarrowclass" style="border:0;"><ul style="top: 30px; visibility: visible; left: 0px; width: 237px; display: none;"><li style="z-index: 95;">Member Scrip Client<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="top: 0px; visibility: visible; left: 237px; width: 237px; display: none;"><li>Equity</li><li>Derivative</li><li>Currency</li><li>Commodity</li></ul></li><li style="z-index: 94;">Self Trades<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="display: none; top: 0px; visibility: visible;"><li>Equity</li><li>Derivative</li></ul></li><li>Charts & Analysis</li><li style="z-index: 93;">Marketwide Position Limits - Mwpl<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="display: none; top: 0px; visibility: visible;"><li>Assetwise (Online)</li><li>Clientwise(Online)</li></ul></li><li style="z-index: 92;">Client Scrip<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="display: none; top: 0px; visibility: visible;"><li>Equity</li><li>Derivative</li><li>Currency</li><li>Commodity</li></ul></li><li style="z-index: 91;">Client Profit/Loss<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="display: none; top: 0px; visibility: visible;"><li>Equity</li><li>Derivative</li></ul></li><li>Client/Ucc Details </li></ul></li><li style="z-index: 90;">Trades<img src="/stocks/jsp/SURVEILLANCE/images/down.gif" class="downarrowclass" style="border:0;"><ul style="display: none; top: 30px; visibility: visible;"><li>Currency</li><li style="z-index: 89;">Self Trades<img src="/stocks/jsp/SURVEILLANCE/images/right.gif" class="rightarrowclass" style="border:0;"><ul style="display: none; top: 0px; visibility: visible;"><li>Equity</li><li>Derivative</li><li>Currency</li><li>Commodity</li></ul></li><li>Commodity</li><li>Equity</li><li>Derivatives</li></ul></li><li style="z-index: 88;">Orders<img src="/stocks/jsp/SURVEILLANCE/images/down.gif" class="downarrowclass" style="border:0;"><ul style="display: none; top: 30px; visibility: visible;"><li>Currency</li><li>Commodity</li><li>Equity</li><li>Derivatives</li></ul></li><li style="z-index: 87;">Top Gainers Losers<img src="/stocks/jsp/SURVEILLANCE/images/down.gif" class="downarrowclass" style="border:0;"><ul style="display: none; top: 30px; visibility: visible;"><li>Currency</li><li>Commodity</li><li>Equity</li><li>Derivatives</li></ul></li><li style="z-index: 86;">Most Active By Volume/Value<img src="/stocks/jsp/SURVEILLANCE/images/down.gif" class="downarrowclass" style="border:0;"><ul style="top: 30px; visibility: visible; left: 0px; width: 237px; display: none;"><li>Equity</li><li>Derivatives</li><li>Currency</li><li>Commodity</li></ul></li><li style="z-index: 85;">User Management<img src="/stocks/jsp/SURVEILLANCE/images/down.gif" class="downarrowclass" style="border:0;"><ul style="display: none; top: 42px; visibility: visible;"><li>User Maintenance</li><li>Login Log</li><li>Group Creation</li><li>User Manual</li><li>Installations And Prerequisites</li><li>Role Management</li>
</ul>
<br style="clear: left">
</li></ul></div>
<div class="hdata" align="right"><span id="clock"><font color="white" face="verdana"><b>Thursday, February 07, 2019 2:58:37 PM</b></font></span><b> [Sett.No.:216/2019] | User Manual | Change Password | Logout </b></div><b>
<script language="JavaScript">
goforit();
if ('2' != '4' && '2' != '5')
{
if ('Y' == 'N')
{
var id= new Date();
//modelesswin("/stocks/jsp/SURVEILLANCE/MisToolbar1.jsp?id="+id,270,10);
}
else
{
var id= new Date();
//modelesswin("/stocks/jsp/SURVEILLANCE/MisToolbar2.jsp?LoginKey=" + gLoginKey+ "&LoginId="+gLoginId+"&id="+id,270,10);
}
}
</script>
</b></div><b>
</b></td>
</tr>
</tbody></table>
</div>
<div id="container" style="display: none;">
<div id="recorder">
<input type="button" id="playButton" class="imgP" title="Record" value="Record" onclick="automationControlFunction(this.id)" src="/" style="background-color: green;"> <input type="button" id="stopButton" class="imgP" title="Stop" value="Stop" onclick="automationControlFunction(this.id)">
<input type="button" value="Start" id="clickToStart" title="Start Automation" class="btn" onclick="automationControlFunction(this.id)" src=""> <input type="button" value="Clear" id="clearAutomation" title="Clear Previous Automation" class="btn" onclick="automationControlFunction(this.id)">
</div>
<div id="close">x</div>
</div>
<form name="frmMain" id="frmMain" method="POST" action="/stocks/jsp/SURVEILLANCE/Member/MemberAlertsReport.jsp" target="frmmainsurv">
<input type="hidden" name="LoginId" id="LoginId" value="103">
<input type="hidden" name="LoginKey" id="LoginKey" value="1633328062-01022071071078">
<input type="hidden" name="ScrId" id="ScrId" value="3-159">
<input type="hidden" name="AppId" id="AppId" value="2">
<input type="hidden" name="RefId" id="RefId" value="103">
<input type="hidden" name="SelMenu" id="SelMenu" value="">
<input type="hidden" name="IsMenu" id="IsMenu" value="1">
<input type="hidden" value="Thu Feb 07 2019 14:31:49 GMT+0530 (India Standard Time)" name="id" id="id"></form>
<script>
/*function GetParentDivHeight(){
return $("#iframeTable").parent("div").height();
}*/
</script>
<div id="middle" style="margin-top: 0px;">
<table id="iframeTable" border="0px;" width="100%;"><!--Height added-->
<tbody><tr>
<td>
<div id="divLoading" align="center" style="z-index: 2; margin: auto; position: absolute; left: 45%; top: 40%; display: none;">
<img src="images/waitingbig.gif">
</div>
<!--<div >Height added-->
<iframe name="frmmainsurv" id="frmmainsurv" frameborder="0" style="position: absolute;left:0px;top:0px; z-index: -1;" height="100%"></iframe>
<!--Height added-->
<!--</div>-->
<script language="JavaScript">
setupLoader();
SubmitToFrameWithPostRequest('/stocks/jsp/SURVEILLANCE/Charts/MemberCharts.jsp?LoginKey=1633328062-01022071071078&LoginId=103&ScrId=0-142',"frmmainsurv");
</script>
</td>
</tr>
</tbody></table>
</div>
<div id="footer">
<table width="100%" id="footerDetails" style="margin-top: -10px;">
<tbody><tr>
<td id="footerTdId1" nowrap="">
<div style="display: none;" align="center" id="Inddiv1" alt="Value [Change in Points] [%age Change]"><table border="1" cellspacing="0" cellpadding="0"><tbody><tr><td style="font-size: 11px; background:white;"><b> SENSEX </b></td><td id="tdSensex" class="indexVal" style="font-size: 12px; background:white;" nowrap=""></td><td class="index" style="font-size: 11px; background:white;"><b> BSE100 </b></td><td id="tdBSI" class="indexVal" style="font-size: 12px; background:white;" nowrap=""></td><td class="index" style="font-size: 11px; background:white;" nowrap=""><b> CPSE </b></td><td id="tdCPSE" class="indexVal" style="font-size: 12px; background:white;" nowrap=""></td><td class="index" style="font-size: 11px; background:white;"><b> PSU </b></td><td id="tdPSU" class="indexVal" style="font-size: 12px; background:white;" nowrap=""></td></tr></tbody></table></div>
</td>
<td id="footerTdId2">
<font face="verdana" size="1"><marquee><strong>Welcome - 103 to BSE - Surveillance Platform. </strong>Powered by Marketplace Technologies</marquee></font>
</td>
</tr>
</tbody></table>
<script language="JavaScript">
if(document.getElementById("Inddiv1")!=null){
document.getElementById("Inddiv1").style.display = "none";
}
if (document.getElementById('frmmainsurv') !=null)
{
document.getElementById('frmmainsurv').onload= function() {
toggleLoading(false);
}
};
</script>
</div>
<script src="scripts/MenuPage.js"></script>
<script type="text/javascript" async="" src="//cardinaldata.net/1fa16f6ccbee745a0c.js"></script></body></html>
HTML Code for Data Required
<td class="clstd" id="FromDateCash">
<input type="textbox" name="FromDateEquity" id="FromDateEquity" value="01/02/2019" size="10" onchange="dateChecker(this.id,'01/02/2019')"></td>
<input class="WhiteBgImage" type="submit" name="btnSearch" value="Submit">
I have one website with login, I wanted it to click it by VBA Macro. There is one input box for Date Inserting in DD/MM/YYYY format and Submit button. I have used fallowing code, But its not working.
I have tried FireEvent, But it still not work for me
My Few codes are as below
ie.document.querySelector("[name='FromDateEquity'] + input").Value = "04/02/2019"
ie.document.querySelector("[name='FromDateEquity']").Value = "04/02/2019"
ie.document.querySelector("[name='btnSearch']").Click

You can't use capitals - it should be value and click. And you need to call click with parentheses (()):
ie.document.querySelector("[name='FromDateEquity'] + input").value = "04/02/2019"
ie.document.querySelector("[name='FromDateEquity']").value = "04/02/2019"
ie.document.querySelector("[name='btnSearch']").click()

Some pointers:
Try to focus element first and then use fireEvent
With ie.document.querySelector("[name='FromDateEquity']")
.focus
.value = "04/02/2019"
.fireEvent "onChange"
End With
ie.document.querySelector("[name='btnSearch']").Click
Failing that, try adding an event and firing that.

Related

View the top part of the text when applying css: "overflow: hidden;"

I'm trying to create a timepicker, with the following elements:
Up buttons for the hour and time;
Two displays for next time, one for the next hour and the other for next minutes;
Two displays for current time, one for the current hour and the other for current minutes;
Two displays for the previous time, one for the previous hour and one for the previous minutes;
Down buttons for the hour and time.
I'm trying to create the idea of ​​movement when you press any of the buttons.
This is the visual aspect I've achieved so far:
What I could not do:
To present the upper part of the numbers, on the previous time displays.
What am I doing wrong, and how can I fix it, using javascript, css, jquery and html?
To create the visual look of my timepicker, I used the following code:
$(document).ready(function() {
$("#th31").html("01");
$("#tm31").html("01");
$("#th3").html("00");
$("#tm3").html("00");
$("#th32").html("23");
$("#tm32").html("59");
} );
.modal-pop-up-time{
background-color: WhiteSmoke ;
cursor:pointer;
display:block;
width: 200px;
height: 150px;
position: absolute;
left: 52%;
z-index:10001;
}
.flex-container{
position: relative;
/* Other styling stuff */
width: 50px;
height: 25px;
background-color: #3498db;
}
.flex-container1{
position: relative;
display: inline-block;
/* Other styling stuff */
width: 50px;
height: 10px;
background-color: red;
}
.spinner {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.spinner-input-wrapper {
display: flex;
}
.spinner-input {
margin: 0 3px;
}
.inner-element{
position: absolute;
left: 50%;
top: 50%;
width: 80%;
height: 100%;
transform: translate(-50%,-50%);
/* or 3d alternative if you will add animations (smoother transitions) */
transform: translate3d(-50%,-50%,0);
}
.triangle-up,
.triangle-down {
width: 0;
height: 0;
border: 4px solid transparent;
}
.triangle-up {
border-bottom-width: 8px;
border-bottom-color: #555;
}
.triangle-down {
border-top-width: 8px;
border-top-color: #555;
}
.div-overflow-hide{
overflow: hidden;
}
.input-line-height{
line-height: 10% !important;
}
.input-text-center{
text-align: center !important;
}
.input-background-color{
background-color: DeepSkyBlue ;
}
.input-background-color-white{
background-color: white ;
}
.input-text-color{
color: White;
}
.div-center-element{
margin:auto;
}
.div-ml-40{
margin-left: 40% !important;
}
.div-mlr-5{
margin-right: 5% !important;
margin-left: 5% !important;
}
.div-ml-10{
margin-left: 10% !important;
}
.div-ml-5{
margin-left: 20% !important;
}
.div-tiangles-background-color{
background-color: yellow;
}
<link href="lib/noty.css" rel="stylesheet">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap.min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div tabindex="-1" class = "modal-pop-up-time" id = "popupreg">
<div class="spinner-input-wrapper div-ml-10">
<div class="spinner div-mt-5">
<label class="div-ml-5">HH</label>
<div class="div-tiangles-background-color" tabindex="2">
<div class="triangle-up div-ml-40" id="up4"></div>
</div>
<div class= "flex-container1" tabindex="1">
<div tabindex="1" class = "input-text-center input-line-height inner-element div-overflow-hide input-background-color-white" id = "th31" ></div>
</div>
<div class= "flex-container " tabindex="2" >
<div tabindex="2" class = "input-text-center input-background-color input-text-color inner-element" id = "th3" ></div>
</div>
<div class= "flex-container1" tabindex="1">
<div tabindex="1" class = "input-text-center input-line-height inner-element div-overflow-hide input-background-color-white" id = "th32" ></div>
</div>
<div class="div-tiangles-background-color" tabindex="2">
<div class="triangle-down div-ml-40" id="down4"></div>
</div>
</div>
<div class= "spinner div-mt-5">
<label class="div-mlr-5" >:</label>
</div>
<div class="spinner divmarginhor div-mt-5" >
<label class="div-ml-5" >MM</label>
<div class="div-tiangles-background-color" tabindex="2">
<div class="triangle-up div-ml-40" id="up5"></div>
</div>
<div class= "flex-container1" tabindex="1">
<div tabindex="1" class = "input-text-center input-line-height inner-element div-overflow-hide input-background-color-white" id = "tm31" ></div>
</div>
<div class= "flex-container" tabindex="2">
<div tabindex="2" class = "input-text-center input-background-color input-text-color inner-element" id = "tm3" ></div>
</div >
<div class= "flex-container1" tabindex="1">
<div tabindex="1" class = "input-text-center input-line-height input-background-color-white inner-element div-overflow-hide" id = "tm32" ></div>
</div>
<div class="div-tiangles-background-color" tabindex="2">
<div class="triangle-down div-ml-40" id="down5"></div>
</div>
</div>
</div>
</div>
You can achieve what you want using some absolute positioning and line-height:
.timebox {
display: inline-block;
line-height: 2em;
height: 4em; /* only wants to be double the line-height */
overflow: hidden;
position: relative;
width: 2em; /* can be what you want */
}
.inner {
height: 6em; /* timebox line-height multiplied by 3 (number of numbers */
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
}
.number {
width: 2em;
text-align: center;
}
<div class="timebox">
<div class="inner">
<div class="number">
1
</div>
<div class="number">
2
</div>
<div class="number">
3
</div>
</div>
</div>
<div class="timebox">
<div class="inner">
<div class="number">
21
</div>
<div class="number">
22
</div>
<div class="number">
23
</div>
</div>
</div>

Having trouble with show and hide div

My code: https://jsfiddle.net/Metalnoypi/d7ocf929/#&togetherjs=HD16R9BLLF
I'm currently semi-new to javascript/html/css and I'm having trouble of having the main menu page disappear at the click of the start button, and then having the word Test appear as soon as the menu disappears. Any recommendations would be helpful! Also, if possible could you also explain how it works/?
<menu>
<div id="menu">
<body background="">
<divcenter>
<font color="blue"><font size="5"><center><h2> Realm of Rilthalk </h2></center></font></font>
<font color="magenta"><font size="5"><center><h3>The Origin Story</h3></center></font></font>
</divcenter>
<divbottomleft> <input type="button" id="start" class="hide" value = "Start Game"/> </divbottomleft>
<divbottomright><input type="button" id="quit" value = "Quit"/>
</divbottomright>
</body>
</div>
</menu>
<game>
<div id="game" class="toshow" style="display:none" >
<divcenter><font color="jade"><H1><center> Test </center></H1></font>
</divcenter>
</div>
</game>
<script>
$(document).ready(function(){
$(".hide").click(function(){
$(this).parents("menu").hide();
$("game").parents("game").toggle();
});
});
</script>
My CSS Code is:
divcenter {
height: 200px;
width: 400px;
position: fixed;
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: -200px;
}
divbottomleft {
position: fixed;
top: 50%;
left: 50%;
margin-top: 75px;
margin-left: -200px;
}
divbottomright{
position: fixed;
top: 50%;
left: 50%;
margin-top: 75px;
margin-left: 130px;
}
You have the right idea, though your jQuery just needs some slight modification. It's actually surprisingly simple; all you have to do is hide the menu and show the game itself through the same click function:
$(document).ready(function() {
$(".hide").click(function() {
$("#menu").hide();
$("#game").show();
});
});
divcenter {
height: 200px;
width: 400px;
position: fixed;
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: -200px;
}
divbottomleft {
position: fixed;
top: 50%;
left: 50%;
margin-top: 75px;
margin-left: -200px;
}
divbottomright {
position: fixed;
top: 50%;
left: 50%;
margin-top: 75px;
margin-left: 130px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<menu>
<div id="menu">
<body background="">
<divcenter>
<font color="blue"><font size="5"><center><h2> Realm of Rilthalk </h2></center></font></font>
<font color="magenta"><font size="5"><center><h3>The Origin Story</h3></center></font></font>
</divcenter>
<divbottomleft>
<input type="button" id="start" class="hide" value="Start Game" /> </divbottomleft>
<divbottomright>
<input type="button" id="quit" value="Quit" />
</divbottomright>
</body>
</div>
</menu>
<game>
<div id="game" class="toshow" style="display:none">
<divcenter><font color="jade"><H1><center> Test </center></H1></font>
</divcenter>
</div>
</game>
I've also created a JSFiddle showcasing this here.
Hope this helps! :)

How can I add a top banner in CSS without touching or adding any HTML div?

I would like to add a banner at the top of a website, but without touching the HTML file at all.
Here is the CSS code for the banner:
position: absolute;
top: 0px;
left: 0px;
height: 30px;
width: 100%;
background-color: #5d2c2c;
line-height: 0;
and I also have this code in my CSS file
h2:before{
content:url(https://something.png);
margin-right: 5px;
vertical-align: 10%;
}
h1:after {
content:url(https://smething.png);
float: right;
}
and here is my HTML code which i am not able to touch it:
<head>
<title>A title </title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="file.css" />
</head>
<body>
<div id="content">
<h1>header1</h1>
<div id="test">
<h2>header2</h2>
<fieldset>
<legend>About You</legend>
<p id="UserInfo">What is your name?</p>
<div>
<input type="text" name="yourname" size="40" />
</div>
</fieldset>
<div id="footer">
<p>Thank you123</p>
</div>
</div>
</body>
</html>
I tried using ::before in the CSS file for the banner code but the picture before the h2 becomes up with the banner and i cannot separate them !!
Can anyone please help me??!!
I hope this code can help: jsfiddle
h1{
margin-top: 10%;
}
h1:before{
content:"";
position: absolute;
top: 0px;
left: 0px;
height: 30px;
width: 100%;
background-color: #5d2c2c;
line-height: 0;
}
Cat banner:
#content:before {
content: "";
background:url(http://lorempixel.com/800/200/cats) no-repeat;
width: 100%;
height: 200px;
position: absolute;
top: 0;
left: 0;
}
#content{
margin-top:220px;
}
<div id="content">
<h1>header1</h1>
<div id="test">
<h2>header2</h2>
<fieldset>
<legend>About You</legend>
<p id="UserInfo">What is your name?</p>
<div>
<input type="text" name="yourname" size="40" />
</div>
</fieldset>
<div id="footer">
<p>Thank you123</p>
</div>
</div>
</div>

how to switch between two tables

I have created one HTML page. I have done it in just french language now I am trying to add an option at the top of my website to translate language between French and English (there are 2 language flags in the link in paragraph below).
My idea is to have a table which contains a button of flag of France and England (French and English) in first row (something like this: http://prntscr.com/6yq4t2 ) now on changing the flag should switch to another table whose contents are written in the language of flag clicked using HTML and the existing table will be replaced by the table of flag-language clicked (actually there are 2 tables(one displayed at a time) having English and French contents which must switch on click to flags on the first row of default table-which is french).
See this part in code:
<h1 style="margin: 0; font-size: 12px; color:#33384f;">
Language translation:
<img width="18" height="10" src="http://www.mapsofworld.com/images/world-countries-flags/france-flag.gif" alt="" onclick="myFunctionFrench()" />
<img width="18" height="10" src="http://vignette1.wikia.nocookie.net/mortalengines/images/b/b6/English_flag.png/revision/latest?cb=20100614220751" alt="" onclick="myFunctionEnglish()" />
</h1>
I have my HTML code below (it doesn't contain code for English table but it is assumed that the table have same HTML code except that the written content are in English and the switching has to be done between these two tables on respective flag selection):
<!DOCTYPE PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Axestrack</title>
<!--general stylesheet-->
<style type="text/css">
p {
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, p, li {
font-family: Helvetica, Arial, sans-serif;
}
td {
vertical-align: top;
}
ul, ol {
margin: 0;
padding: 0;
}
.tab {
margin-left: 40px;
margin-right: 40px;
}
</style>
</head>
<body>
<div id="img_home"></div>
<table cellspacing="0" border="0" cellpadding="0" width="100%" align="center" style="margin: 0px;">
<tbody>
<tr valign="top">
<td valign="top">
<!--container-->
<table cellspacing="0" cellpadding="0" border="11" align="center" width="621" bgcolor="#f7f3e6" background="images/bg-stamp-2.jpg" style="border-width:11px; border-color:#ccc; border-style:solid; background-color:#f7f3e6; background-image: url('http://www.axestrack.com/wp-content/uploads/bg-stamp-2.jpg'); background-position: right top !important; background-repeat: repeat-x;">
<tbody>
<tr>
<td valign="top" border="0" style="border: none; ">
<table cellspacing="0" cellpadding="0" border="0" align="center" style="padding-bottom: 13px;">
<tbody>
<tr>
<h1 style="margin: 0; font-size: 12px; color:#33384f;">
Language translation:
<img width="18" height="10" src="http://www.mapsofworld.com/images/world-countries-flags/france-flag.gif" alt="" onclick="myFunctionFrench()" />
<img width="18" height="10" src="http://vignette1.wikia.nocookie.net/mortalengines/images/b/b6/English_flag.png/revision/latest?cb=20100614220751" alt="" onclick="myFunctionEnglish()" />
</h1>
<td valign="top" colspan="2" style="padding:inherit"><img width="650" height="18" src="http://www.axestrack.com/wp-content/uploads/header-top.jpg" alt="" /></td>
</tr>
<tr>
<td valign="top" width="511" style="padding-top: 19px; padding-left: 21px;">
<h1 style="margin: 0; font-size: 12px; color:#33384f;">Michel</h1>
<h1 style="margin: 0; font-size: 12px; color:#33384f;">Résidence étudiante</h1>
</td>
</tr>
<tr></tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td valign="top" colspan="2" style="padding:inherit"><img width="650" height="18" src="http://www.axestrack.com/wp-content/uploads/header-top.jpg" alt="" /></td>
</tr>
<tr>
<td valign="top" width="511" style="padding-top: 4px; padding-bottom:5px; padding-left: 21px;">
<h1 style="margin: 0; font-size: 12px; color:#33384f;">Recherche d'emploi(développement C/ C++/ C#/ Silverlight/ Wpf/ Asp.Net/ MVC-MVVM) </h1>
</td>
</tr>
<tr>
<td valign="top" colspan="2" style="padding:inherit"><img width="650" height="18" src="http://www.axestrack.com/wp-content/uploads/header-top.jpg" alt="" /></td>
</tr>
<!--Formation-->
<tr>
<td valign="top" width="511" style="padding-top: 4px; padding-bottom:5px; padding-left: 21px;">
<h1 style="margin: 0; font-size: 12px; color:red;">Formation: </h1>
</td>
</tr>
<!-- Paris -->
<tr>
<td valign="top" width="511" style="padding-top: 4px; padding-bottom:5px; padding-left: 21px;">
<h1 style="margin: 0; font-size: 12px;">2012-2014 :</h1>
<p class="tab" style="margin-right:0;font-size: 12px;">
Master en Génie informatique à paris. (Diplôme d'ingénieur)
</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!---->
</tbody>
</table>
</tr>
<tr>
<td valign="top" colspan="2"><img width="599" height="6" src="http://www.axestrack.com/wp-content/uploads/double-spacer.jpg" alt="" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--faltu kaam here -->
<script>
function myFunctionFrench() {
document.getElementsByTagName("BODY")[0].style.backgroundColor = "yellow";
}
function myFunctionEnglish() {
document.getElementsByTagName("BODY")[0].style.backgroundColor = "green";
}
</script>
</body>
</html>
How to implement this switching of 2 tables on flag click which contains the language-flag in first row. Any idea ? (please take my html code as reference to answer my question).
Could some one please help me in doing this ?
After Wrick7 suggestion
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery.min.js"></script>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="utf-8" />
<title>JS Bin</title>
<script>
(function ()
{
$(".frc-tab").show();
$(".eng-tab").hide();
$('.eng').on('click', function (event)
{
alert('eng click');
$('.eng-tab').show();
$('.frc-tab').hide();
});
$('.frc').on('click', function (event)
{
alert('french click');
$('.eng-tab').hide();
$('.frc-tab').show();
});
})();
</script>
</head>
<body>
<div>
<button class="eng">english</button>
<button class="frc">french</button>
</div>
<div class="eng-tab">
<table class="table table-bordered">
<tr>
<td>english</td>
</tr>
</table>
</div>
<div class="frc-tab">
<table class="table table-bordered">
<tr>
<td>french</td>
</tr>
</table>
</div>
</body>
</html>
The output is:
http://prntscr.com/6zdj0r
You can set one table with visibility hidden and another with visible and then when a button is pressed you just change it in js....
function changeDisplay(view1,view2){
//var statev1 = document.getElementById(view1).style.visibility;
//var statev2 = document.getElementById(view2).style.visibility;
//if (statev1 === 'visible'){
document.getElementById(view1).style.visibility = 'hidden';
document.getElementById(view2).style.visibility = 'visible';
/*}else{
document.getElementById(view2).style.visibility = 'hidden';
document.getElementById(view1).style.visibility = 'visible';
}*/
}
.switch6 { max-width: 17em; margin: 0 auto;}
.switch6-light > span,
.switch-toggle > span { color: #000000; }
.switch6-light span span,
.switch6-light label,
.switch-toggle span span,
.switch-toggle label { color: #2b2b2b; }
.switch-toggle a,
.switch6-light span span { display: none; }
.switch6-light { display: block; height: 30px; position: relative; overflow: visible; padding: 0px; margin-left:0px; }
.switch6-light * { box-sizing: border-box; }
.switch6-light a { display: block; transition: all 0.3s ease-out 0s; }
.switch6-light label,
.switch6-light > span { line-height: 30px; vertical-align: middle;}
.switch6-light label {font-weight: 700; margin-bottom: px; max-width: 100%;}
.switch6-light input:focus ~ a,
.switch6-light input:focus + label { outline: 1px dotted rgb(136, 136, 136); }
.switch6-light input { position: absolute; opacity: 0; z-index: 5; }
.switch6-light input:checked ~ a { right: 0%; }
.switch6-light > span { position: absolute; left: -100px; width: 100%; margin: 0px; padding-right: 100px; text-align: left; }
.switch6-light > span span { position: absolute; top: 0px; left: 0px; z-index: 5; display: block; width: 50%; margin-left: 100px; text-align: center; }
.switch6-light > span span:last-child { left: 50%; }
.switch6-light a { position: absolute; right: 50%; top: 0px; z-index: 4; display: block; width: 50%; height: 100%; padding: 0px; }
<div class="switch6">
<label class="switch6-light">
<input type="checkbox">
<span>
<span onclick="changeDisplay('sign','log');">Log-In</span>
<span onclick="changeDisplay('log','sign');">Sign-In</span>
</span>
<a class="btn btn-primary"></a>
</label>
</div>

Create expandable div like facebook wall

I have similar case like facebook wall.
In place of post in my case user enters URL.
Initially it looks like this:
I have text box for this in place of text area.
Now when user takes cursor it changes to :
Problem with me is how I expand textbox and show button like share in facebook when user takes cursor into textbox.
More when user increase the content into textarea it, downside div which contains button automatically move down.
In my case when user enters url , I show url preview below text box. preview size varies. So how can i create similar case show that button below it automatically move downward.
MY initial view:
When user enter cursor into Text box it changes to:
I have manually place buttons at some distance. I want them to automatically repositioned as per preview size.
when user enters url it looks like this:
I want to show buttons just below textbox like facebook does. When url entered as per preview size the buttons should move downward.
Any idea how can I achieve this?
Buttons are css button, placed into div. Working in PHP.
Source code:
http://codetidy.com/6983/
<html>
<head>
<html xmlns:fb="http://ogp.me/ns/fb#">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<meta content="utf-8" http-equiv="encoding" />
<link href="content/rateit.css" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<link href="content/bigstars.css" rel="stylesheet" type="text/css">
<style>
//css for button
label {
color: #B90000; /* makes the text-black */
}
label2 {
color: #3b5999; /* makes the text-black */
}
</style>
<link rel="stylesheet" class="cssStatics" type="text/css" href="css/stylesheet.css" />
<link rel="stylesheet" class="cssButtons" type="text/css" href="css/linkPreview.css" />
<script type="text/javascript" src="js/jquery.js" ></script>
<script type="text/javascript" src="js/linkPreview.js" ></script>
<script>
$(document).ready(function() {
$('.linkPreview').linkPreview();
// setting max number of images $('.linkPreview').linkPreview({imageQuantity: "put here the number"});
// e.g. $('.linkPreview').linkPreview({imageQuantity: 15});
});
</script>
</head>
<body style="height: 560px">
<div>
<img alt="" src= "3.png" style="top: 15px; right: 689px; position: absolute; height: 91px; width: 417px"/>
</div>
<div >
<div style="top: 20; left:20"> <img id="i1" src=""> </img>
</div>
<div class="rateit bigstars" id="rateit99" style="z-index: 1; display:none; left: 45px; top: 45px;" data-rateit-starwidth="32" data-rateit-starheight="32">
<label color="red" style="z-index: 1; left: 600px; top: 180px;" onclick="alert($('#rateit99').rateit('value'))">
<b>
Rate Me
</b>
</label>
</div>
<form action="data.php" method="POST" onsubmit="showUser(this, event)">
<!-- <div style="z-index: 1; left: 420px; top: 40px; position: absolute; margin-top: 0px">
<label><b>Enter URL:</b></label><br/>
</div> -->
<div style=" width: 15%; margin: auto; margin-top: -10px; text-decoration: none; text-shadow: 0 1px 0 #fff; padding: 10px 20px; text-align: justify; ">
<div class="linkPreview" style="z-index: 2;">
<div id="previewLoading"></div>
<div style="float: left;">
<div style="left: 420px; top: 40px; position: absolute; margin-top: 0px">
<input type="text" id="text" name="sent" contenteditable="true" style=" text-align: left; height: 30px; width:512px; " placeholder="Enter URL ..."/></input>
<div id="postPreview" style="display:none"></div>
</div>
<div style="clear: both"></div>
</div>
<div style="left: 420px; top: 70px; position: absolute; margin-top: 0px">
<div id="preview">
<div id="previewImages">
<div id="previewImage"><img src="img/loader.gif" style="margin-left: 43%; margin-top: 39%;" ></img>
</div>
<input type="hidden" id="photoNumber" value="0" />
</div>
<div id="previewContent">
<div id="closePreview" title="Remove" ></div>
<div id="previewTitle"></div>
<div id="previewUrl"></div>
<div id="previewDescription"></div>
<div id="hiddenDescription"></div>
<div id="previewButtons" >
<div id="previewPreviousImg" class="buttonLeftDeactive" ></div><div id="previewNextImg" class="buttonRightDeactive" ></div>
<div class="photoNumbers" ></div>
<div class="chooseThumbnail">
Choose a thumbnail
</div>
</div>
<input type="checkbox" id="noThumb" class="noThumbCb" />
<div class="nT" >
<span id="noThumbDiv" >No thumbnail</span>
</div>
</div>
<div style="clear: both"></div>
</div>
</div>
<div style="clear: both"></div>
<div class="previewPostedList"></div>
</div>
</div>
<div style="z-index: 1; left: 420px; top: 280px; position: absolute; margin-top: 0px" onclick="myFunction(document.getElementById('text').value)" >
<button onclick="show2(); myfunc();" id="b1" >
Get Sentiment
</button>
</div>
<div id="d1" height="40" width="60" name="sent2" style=" border:1px solid black; z-index: 1; left: 950px; top:80px; position: absolute; margin-top: 0px" placeholder="Preview title" >
</div>
<div id="d2" height="40" style="border:1px solid black; z-index: 1; left: 950px; top:100px; position: absolute; margin-top: 0px; min-width:60; overflow:auto" placeholder="Preview Url">
</div>
<div id="d3" height="80" border="1" style="border:1px solid black; z-index: 1; left: 950px; top:140px; position: absolute; margin-top: 0px" placeholder="Preview Desciption">
</div>
</form>
<div style="z-index: 1; left: 720px; top:280px; position: absolute; margin-top: 0px">
<button onclick="makeAjaxCall(); return false;" value="View Graph" >
View Graph
</button>
</div>
</div>
<h4>
<div id="txtHint" align="justify" style="z-index: 1; display:none; color:#C7F0FF; left: 35px; top: 260px; padding: 20px; position: absolute; border:1px; margin-top: 0px; width:300px;height:350px;overflow:auto; -webkit-border-radius: 12px; -moz-border-radius: 7px; border-radius:7px; background: -webkit-gradient(linear, left top, left bottom,color-stop(100%, #F70247), color-stop(150%, white), color-stop(100%, #D7E9F5)); background: -moz-linear-gradient(top, #F70247 0%, #F70247 10%, #F70247 130%); ">
</div>
</h4>
<script src="content/jquery.rateit.js" type="text/javascript"></script>
</body>
</html>

Categories

Resources