Reputation: 1752
When I run this code, it doesn't set the innerHTML
of console
. The last two alert()
s aren't working either. The console
id
exists, as in a later portion of the docuument, its innerHTML
is set into another variable successfully. What errors do I have?
The parameters in the url both exist as well because the first two alert()
s work.
var console = getParameterByName('consoletext');
alert(console);
var submission = getParameterByName('input');
alert(submission);
document.getElementById("console").innerHTML = console + submission;
var text = document.getElementById("console").innerHTML;
alert(text);
alert("text");
//parseInput(submission);
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function parseInput(input) {
}
Upvotes: -1
Views: 936
Reputation: 116
I wouldn't use console
, as per other answer. But it should still work, there is nothing wrong with your code and it works in my browser.
Do you get any errors, like your #console element not yet being loaded?
Other than that, it might be a mistake in code or markup you did not post.
Upvotes: 1