Copy code code as follows:
<div ID = "Slides">
<div ID = "content-main" name = "content-main">
<div id = "a">
<IMG SRC = "IMG/Example-Slide -jpg">
</div>
</div>
<div ID = "content-main" name = "content-main">
<div id = "b">
<IMG SRC = "IMG/Example-Slide-2.jpg">
</div>
</div>
</div>
<input id = "p" type = "Button" value = "add" onClick = "add1 ();"/>
<input ID = "p" type = "Button" Value = "add33" OnClick = "Clear ();"/>
Copy code code as follows:
Function add1 () {// Add a div Content-main
var obj = document.createElement ("div");
obj.id = "Content-Main";
obj.innerHTML='<div id="c">'+
'<img src="img/example-slide-3.jpg">'+
'</div>';
$('#slides').append(obj);
}
function clear(){//Clear all divs and imgs under slides
var div1=document.getElementById("slides").getElementsByTagName("div");
for(var i=0;i<div1.length;i++){
div1 [i] .innerhtml = '';
}
}
Copy code code as follows:
Function clearText (DIVINPUT) {// Clear the content of Text text boxes under the empty div, reset
var txts = document.GetelementByid ('divinput'). GetelementsBytagname ("input");
for (var I = 0; I <txts.length; i ++)
{{
if (txts [i] .Type == "Text") {{
txts [i]. Value = ""; // Text empty
}
}
var selects = document.GetelementByid ('Divinput'). GetelementsBytagname
for (var I = 0; I <selects.length; i ++)
{{
Selects [i] .Options [0] .select = true; // Select the first item
}
}