Created
May 11, 2017 14:45
-
-
Save dusekdan/2e15bdaa6e059c4e2fe9276c75135790 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
// Identificator of span which display mode should be altered | |
var SPAN_IDENTIFICATION = 'elementident'; | |
function changeDisplayModeToBlock(elementId) | |
{ | |
// Not that despite change of SPAN with ID is required, it is not | |
// neccessary to verify that element is SPAN. There should be only | |
// one occurence of ID in document, so if there is another element | |
// with given ID that is not SPAN, we would be applying the function | |
// to invalid document. Also it's probably not what they wanted to | |
// test anyways. | |
var element = document.getElementById(elementId); | |
element.style.display = 'block'; | |
// Just put this here to see it more clearly | |
element.style.background = 'red'; | |
} | |
</script> | |
</head> | |
<body onload="changeDisplayModeToBlock(SPAN_IDENTIFICATION)"> | |
<span> | |
This span should not be affected. | |
</span> | |
<span id="elementident"> | |
This is span which style property "display" should be changed by javascript to "block" (was "inline") | |
</span> | |
<span id="not-our-id"> | |
Neither this span should be affected. | |
</span> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment