Sure! I'll modify the value of param2 from 'hello' to the current web address using JavaScript's window.location.href. Below is the updated HTML code with the necessary change highlighted.
Updated HTML Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Command Input</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
}
.container {
background-color: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
input {
margin-right: 10px;
padding: 5px;
}
button {
padding: 5px 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 3px;
cursor: pointer;
}
#output {
margin-top: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<label for="commandInput">Enter command: </label>
<input type="text" id="commandInput">
<button onclick="processCommand()">Submit</button>
<div id="output"></div>
</div>
<script>
function processCommand() {
const input = document.getElementById('commandInput').value;
const outputElement = document.getElementById('output');
outputElement.textContent = `You entered: ${input}`;
}
</script>
</body>
</html>
<html manifest="roland.manifest">
<head>
<title>Striker In The Crypt Of Trojan</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body />
<script type="text/javascript">
ie = 0
</script>
<!--[if IE]><script type="text/javascript">ie=1;onhelp=function(){return false}</script><script type="text/vbscript" src="ie.vbscript"></script><![endif]-->
<script type="text/javascript">
pb = [];
param2 = pbf = pbt = frc = game = t = u = 0;
function cb(b, c) {
if (c == 1)
emul = b;
else
game = b;
if (c == 3)
document.write(game);
else if (!t--)
this.eval(emul.substr(311365));
else if (c == 2) {
k = b.indexOf('\0');
ci = b.length;
frc = bp = k + 1;
while (bp < ci)
pbf += (ap = b.charCodeAt(--ci)), ap != 255 && bp++;
while (ci < b.length)
ap = b.charCodeAt(ci++), pb[pbt++] = ap == 255 ? ap : ap
| b.charCodeAt(frc++) << 8;
frc = pb[0] & 255;
param = b.substr(0, k), param1 = param.split('/')[0],
param2 = param.split('/')[1], ajax(
(param1.slice(-1) == 'a' ? 'snaps/' : 'games/')
+ param1, 0);
}
}
function ajax(f, g, h) {
var xhr = new XMLHttpRequest();
if (g < 0)
xhr.onreadystatechange = function() {
if (xhr && xhr.readyState == 4)
rt(ie ? bin2arr(xhr.responseBody)
: bin2str(xhr.responseText));
};
else
xhr.onreadystatechange = function() {
if (xhr && xhr.readyState == 4)
cb(ie ? bin2arr(xhr.responseBody)
: bin2str(xhr.responseText), h);
};
xhr.open(g ? 'POST' : 'GET', f, true);
if (!ie)
xhr.overrideMimeType('text/plain;charset=x-user-defined');
xhr.send(g);
}
function bin2str(a) {
return a.replace(/[\s\S]/g, function(t) {
return String.fromCharCode(t.charCodeAt(0) & 255);
});
}
function bin2arr(a) {
return arr(a).replace(/[\s\S]/g, function(t) {
v = t.charCodeAt(0);
return String.fromCharCode(v & 0xff, v >> 8);
}) + arrl(a);
}
k = location.href.indexOf('?') + 1;
ifra = location.href.slice(-1) == '#';
/*
if (k) {
params = param = decodeURI(ifra ? location.href.slice(k, -1)
: location.href.slice(k));
param1 = param.split('/')[0];
param2 = param.split('/')[1];
t++;
if (param1.slice(-1) == 'c')
t++, ajax('recorded/' + param1, 0, 2);
else
ajax((param1.slice(-1) == 'a' ? 'snaps/' : 'games/') + param1, 0);
}
*/
// XXX formatted and modified 6128s.html: auto start game, so that it can be cached as home screen app
// http://amstrad.co.nf/6128s?striker.dsk/run"stryker on correct server
param1 = 'stryker.dsk';
param2 = window.location.href; // Changed from 'hello' to current web address
t++;
ajax('' + param1, 0);
ajax('_6128s.rom', 0, 1);
</script>
</html>
Explanation of the Change
In the script section of your second HTML block, the line:
param2 = 'hello';
has been changed to:
param2 = window.location.href; // Changed from 'hello' to current web address
This modification sets param2 to the current web address of the page using window.location.href.
Additional Recommendations
-
Single <html> Tag: Your HTML contains two <html> tags, which is not valid HTML structure. It's recommended to merge the contents into a single HTML document to ensure proper rendering and functionality.
-
Encapsulation: Ensure that scripts and styles are properly encapsulated within their respective <head> and <body> sections to maintain clarity and prevent potential conflicts.
-
Error Handling: Consider adding error handling for the AJAX requests to manage scenarios where the request might fail.
-
Security Considerations: Be cautious when using document.write() and eval(), as they can pose security risks like Cross-Site Scripting (XSS). Ensure that any data being processed is properly sanitized.
If you need further assistance integrating this change or restructuring your HTML, feel free to ask!