According to the state display different div

<script>
function a(){
var version = getL(a);
if(version == "undefined"){
To write code to display div1
}else{
To write code to display div2
}
}
</script>
<body onload ="a();">

<div id=div1> . . . . </div>

<div id=div2>.........</div>
Hello, the page has been loaded, will give getL (a) a value, this value is of two kinds, I think according to different circumstances show different Div. Do not know whether the code after the how to write. JS is not very understand, trouble

Started by Christian at December 16, 2016 - 9:01 PM

Set the div display to try it.

Posted by Debra at December 25, 2016 - 9:24 PM

document.getElementById("div1").style.display = "block";
document.getElementById("div2").style.display = "none";


Display or hide? This is to show div1, hidden div2, in turn, to the back of the values we can change.

Posted by Matthew at December 27, 2016 - 9:47 PM