P
pbd22
Hi.
Help much appreciated... thanks
I have a page - Page.aspx.
In the page, there is a button that fires an XMLHTTP event:
return NewPage('srchfrm.aspx?q=' + query.value + "&type=" +
type.value,'tabs-1','tabs-2');
The result is that SrchFrm.aspx is loaded in a DIV on Page.aspx.
Now, in the loaded SrchFrm.aspx there is a drop down list
with associated values. I have a window.load script that
assigns onclick functions for each of the <option> elements
on this page.
If I test this script in SrchFrm.aspx (without
the page being loaded into Page.aspx) it works fine. But, when it is
loaded, it doesn't work.
I am guessing I am missing something along the lines of one form being
loaded into another via ajax. Any suggestions?
Also, Page.aspx has a Window.Onload event but, when I try
to add SrchFrm.aspx's script as a function in this Window.Onload
event, it still does not fire.
Here is my script at the head of SrchFrm.aspx for what it is worth:
<script type="text/javascript">
window.onload = function()
{
var mangaSelect=document.getElementById("fcat");
var maxi = mangaSelect.options.length;
for( var i = 0; i < maxi; i++ )
{
var option = mangaSelect.options;
option.addEventListener( "click", toggleElem, true );
}
};
function toggleElem(event)
{
alert(event.target.value);
}
</script>
Thanks in advance.
Help much appreciated... thanks
I have a page - Page.aspx.
In the page, there is a button that fires an XMLHTTP event:
return NewPage('srchfrm.aspx?q=' + query.value + "&type=" +
type.value,'tabs-1','tabs-2');
The result is that SrchFrm.aspx is loaded in a DIV on Page.aspx.
Now, in the loaded SrchFrm.aspx there is a drop down list
with associated values. I have a window.load script that
assigns onclick functions for each of the <option> elements
on this page.
If I test this script in SrchFrm.aspx (without
the page being loaded into Page.aspx) it works fine. But, when it is
loaded, it doesn't work.
I am guessing I am missing something along the lines of one form being
loaded into another via ajax. Any suggestions?
Also, Page.aspx has a Window.Onload event but, when I try
to add SrchFrm.aspx's script as a function in this Window.Onload
event, it still does not fire.
Here is my script at the head of SrchFrm.aspx for what it is worth:
<script type="text/javascript">
window.onload = function()
{
var mangaSelect=document.getElementById("fcat");
var maxi = mangaSelect.options.length;
for( var i = 0; i < maxi; i++ )
{
var option = mangaSelect.options;
option.addEventListener( "click", toggleElem, true );
}
};
function toggleElem(event)
{
alert(event.target.value);
}
</script>
Thanks in advance.