PDA

View Full Version : how to load script with html file in tabpanel



hemant1
17 Jul 2011, 9:03 PM
Hi,

i want to load the html file in tabpanel for that i write the code in this way
but the problem is the html file is loading properly but in the html file there is a script tag, the script tag is not loading with the html file. i want to execute the script when html file is going to load

pls give me some suggestions

this is my js file



demos.Tab = new Ext.TabPanel({
title: "home",
iconCls: "home",
defaults: {
styleHtmlContent: true
},
items: [{
title: 'Playlist',
scroll: 'vertical',
html: 'test'
}, {
title: "myItemTitle",
id: "myItemId"

}]
},
Ext.Ajax.request({
url: 'i.html',
loadScripts: true,
scripts: true,
success: function (response, opts) {
demos.Tab.items.get(1).update(response.responseText, true); //2nd parameter is "loadScripts"
alert(response.responseText);
},
scope: this
})
);




and this is my html file which i want to load



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

<title>Math</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf8" />

<script type="text/javascript">




function TimerSlide() {

alert("Hi");


}

</script>

</head>


<body>

<H1>Hello </H1>
<input type="button" value="hh" onclick="TimerSlide()" />
</body>

</html>