I have set a variable in one of my javascript files and i want to access that variable in an html file . How do i do the same?
here us my javascript code(file name is JSUI.js):
JSUI = function () {
this.glistName = null;
this.renderUI = function(list) {
this.glistName = list.listName;
window.location="page2.html";
};
};
var gJSUI = new JSUI();
page2.html:
<body>
<script src="js/JSUI.js"></script>
ListName: <input type="text" id="listName"></input>
</body>
<script type="text/javascript">
if(document.readyState="complete"){
document.getElementById("listName").value = gJSUI.glistName;
}
</script>
Basically page2.html gets loaded when renderUI method of JSUI.js is called and i want to populate a textbox present in page2.html with a variable defined in JSUI.js file .How do I achieve the same?
glistNamedeclared? (E.g., where isvar glistNameorlet glistName, if anywhere?)