Using Multiple functions onclick

17 visualizzazioni
Passa al primo messaggio da leggere

thesmartass.info

da leggere,
18 giu 2006, 15:55:0118/06/06
a 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

da leggere,
18 giu 2006, 16:27:3718/06/06
a XMLHttpRequest
try to insert a sleep with a setTimeout.

thesmartass.info

da leggere,
18 giu 2006, 17:17:3918/06/06
a 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

da leggere,
19 giu 2006, 00:48:2819/06/06
a XMLHttpRequest
It works because browser must finish the first XMLHttpRequest and then
to serve the second XMLHttpRequest.

;-)

Daniele

Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi