HEJ,
Jeg kan godt følge dig i dine synspunkter., når jeg ser det i lidt andet lys. Men som du vel allerede har gættet er jeg ikke den store ørn tll Jquery. (Det her er faktisk mit første store projekt i JQ, dels fordi det ville fylde meget mere i JS og fordi jeg har besluttet mig for at nu SKAL JQ læres.) Så jeg offentliggør koden her, men den er under udvikling, så det færdige resultat vil ikke nødvendigvis det samme, som denne kode.
<html>
<head>
<script src="
https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><script type="text/javascript">
$(document).ready(function(){
$('#txtHint').on('click', 'table td', function()
{
alert('test start ');
var cid = $(this).attr('id');
alert('id = ' + cid);
var cval = $(this).text();
alert('text = ' + cval);
alert('test slut ');
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#pasbtn').on('click', function()
{
$("#popup-overlay").css({ visibility: "visible"});
$("#popup-content").css({ visibility: "visible"});
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#clsebtn').on('click', function()
{
$("#popup-overlay").css({ visibility: "hidden"});
$("#popup-content").css({ visibility: "hidden"});
});
});
</script>
<script type="text/javascript">
$(document).ready(function()
{
$("#loggin").on('click', function()
{
var str = "";
str = $("#muser").val() + ";;" + $('#mpasw').val();
alert($("#muser").val() + " -- " + $('#mpasw').val() + " -- " + str);
$("#popup-overlay").css({ visibility: "hidden"});
$("#popup-content").css({ visibility: "hidden"});
$(function(){
$.ajax({
type: "POST",
url: 'getdata.php',
data: ({"Imgname":"13"}),
success: function(data)
{
alert(data);
$('#bruger').val() = data;
}
});
});
});
});
/*
PHP:
$anyData = $_POST['anyData'];
function getAnswer ($inp){
//logic goes here
return "a string of some sort";
}
echo getAnswer($anyData);
exit;
*/
</script>
<style type="text/css">
html
{
z-index: 1;
}
.popup-overlay
{
/* Hides pop-up when there is no "active" class */
visibility: hidden;
position: absolute;
background: #ffffff;
border: 3px solid #666666;
width: 50%;
height: 50%;
left: 25%;
z-index: 10;
border-radius: 15px;
}
.popup-overlay.active
{
/* displays pop-up when "active" class is present */
visibility: hidden;
text-align: center;
}
.popup-content
{
/* Hides pop-up content when there is no "active" class */
visibility: hidden;
}
.popup-content.active
{
/* Shows pop-up content when "active" class is present */
visibility: visible;
}
button
{
display: inline-block;
vertical-align: middle;
border-radius: 30px;
margin: .20rem;
font-size: 1rem;
color: #666666;
background: #ffffff;
border:1px solid #666666;
}
button:hover
{
border: 1px solid #666666;
background :#666666;
color: #ffffff;
}
button2
{
/*
display: inline-block;
vertical-align: middle;
border-radius: 30px;
margin: .20rem;
font-size: 1rem;
color: #666666;
height: 50px;
background: #lightblue;
border:1px solid #666666;
*/
}
.pos22
{
position: absolute;
left: 150px;
top: 25px;
width: 100px;
height: 25px;
border: 1px solid black;
}
.passblok
{
position: Absolute;
left: 750px;
top: 155px;
width: 250px;
height: 65px;
border: 2px solid black;
border-radius: 25px;
background-color: lightgreen;
}
.pos2
{
position: Absolute;
left: 50px;
top: 325px; /* 100px */
width: 950px;
height: 235px;
border: 1px solid blue;
overflow: auto;
}
.selform
{
position: absolute;
left: 50px;
top: 275px;
width: 105px;
}
TR
{
height: 25px;
}
TD
{
height: 25px;
width: 100px;
text-align: Center;
font-family: Verdana;
font-size: 12px;
}
.td2
{
width: 35%;
}
.td3
{
width: 35%;
background-color: lightblue;
}
input
{
border: 1px solid black;
}
.brg
{
position: absolute;
left: 750px;
top: 285px;
width: 200px;
height: 25px;
font-family: Arial;
}
</style>
<script>
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
}
else
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else
{
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}
}
</script>
</head>
<?php
$uge = date(W);
$uge1 = $uge +1;
$uge2 = $uge +2;
?>
<body>
<div class="popup-overlay" id="popup-overlay"> <!--Creates the popup body-->
<div class="popup-content" id="popup-content"> <!--Creates the popup content-->
<center><h2>LOGIN BOKS</h2>
<p> INDTAST BRUGER: <input type="text" id="muser" size='18' value=""></p>
<P> INDTAST PASSORD: <input type="text" id="mpasw" size='18' value=""></p>
<P> </P>
<button class="close" id="clsebtn">LUK </button> <!--popup's close button-->
<button class="close" id="loggin">LOG IND </button> <!--popup's close button-->
</center>
</div>
</div>
<div class="brg" id='bruger'>BRUGER: </div>
<div class="selform">
Velg uge her:<BR>
<select name="users" onchange="showUser(this.value)">
<option value="">Velg en UGE:</option>
<option value="<?php echo $uge ?>">Uge <?php echo $uge ?></option>
<option value="<?php echo $uge1 ?>">Uge <?php echo $uge1 ?></option>
<option value="<?php echo $uge2 ?>">Uge <?php echo $uge2 ?></option>
</select>
</div>
<br>
<div id="txtHint" class="pos2"><b>Tabel data her... </b></div>
<div class="passblok" id='passblok'>
<button class='button2' id='pasbtn'>LOGIN</button>
</div>
</body>
</html>
KR