Using Multiple functions onclick

17 views
Skip to first unread message

thesmartass.info

unread,
Jun 18, 2006, 3:55:01 PM6/18/06
to XMLHttpRequest
I tried to set 2 of the same function for onclick use. so that I can
change multiple boxes on each click. One for a menu, and one for the
content.

First I tried it like this:
onclick="javascript:completeAHAH.ahah('null.htm', 'menu', '', 'GET',
'', this);javascript:completeAHAH.ahah('null.htm', 'gadgets', '',
'GET', '', this);"

That worked Wonderfully in internet explorer, with a 100% success rate
for change, but did not work in firefox at all. firefox just sat there
saying loading data... on one of the two div's

Then I thought, well hell. setting on focus should have the same
results so i did this:

onclick="javascript:completeAHAH.ahah('null.htm', 'menu', '', 'GET',
'', this);" onfocus="javascript:completeAHAH.ahah('null.htm',
'gadgets', '', 'GET', '', this);"

This sort of works in both browsers. It tends to glitch a LOT and
doesn't always show what it needed.

I also tried making a new function (think this is about what i put):
clearit(id1, id2) {
$('id1').completeAHAH.ahah('null.htm', 'menu', '', 'GET', '',
this);
$('id2').completeAHAH.ahah('null.htm', 'gadgets', '', 'GET', '',
this);
}
but alas, that did not work either.

Again, my website is currently a live example:
http://www.thesmartass.info

Thanks
James

daniele...@gmail.com

unread,
Jun 18, 2006, 4:27:37 PM6/18/06
to XMLHttpRequest
try to insert a sleep with a setTimeout.

thesmartass.info

unread,
Jun 18, 2006, 5:17:39 PM6/18/06
to XMLHttpRequest
daniele...@gmail.com wrote:
> try to insert a sleep with a setTimeout.

That works... don't know why it doesn't without. Here is what I did to
get it to work:

<script type="text/javascript">
function clearmenu()
{


completeAHAH.ahah('null.htm', 'menu', '', 'GET', '', this);
}

function cleargadget()
{


completeAHAH.ahah('null.htm', 'gadgets', '', 'GET', '', this);
}

function clearboth()
{
clearmenu();
setTimeout('cleargadget();',1);
}
</script>


<a href="#" onclick="clearboth();">


Thanks
James

daniele...@gmail.com

unread,
Jun 19, 2006, 12:48:28 AM6/19/06
to XMLHttpRequest
It works because browser must finish the first XMLHttpRequest and then
to serve the second XMLHttpRequest.

;-)

Daniele

Reply all
Reply to author
Forward
0 new messages