I am pretty new to Javascript so this is some ugly code I wrote to do the purpose I desired. You can probably get the drift of the code if you look into it. I am having problems with all the timeouts because sometimes they don't happen in the right order. I was wondering if it would be better to use if/then statements to check the url of the iframes to see if they have loaded before executing next command.
Please, Please Help me with this!
I supposed I should explain all of this more clearly first..
function rr= textbox and button for loading rating info of specified user in Iframe "ratingfrm"
function manlogin= login form for yahoo users which targets a hidden iframe "loginframe". This must do several things in order:
1.Log out of yahoo in "loginframe".
2.Submit login form in "loginframe" Only after step 1 is finished.
3.UNhide "loginframe" after step 2.
4.Change url of Iframe-"ratingfrm" based on value of user on form.
Code:<script type="text/javascript"> function rr(){ var ratename=document.rateform.ratebox.value; window.ratingfrm.location="http://profiles.games.yahoo.com/games/profile2?name="+ratename+"&intl=us&consolidater=spades.yahoo";} function manlogin(){ sn=document.manlog.login.value; addy=window.ratingfrm.location="http://profiles.games.yahoo.com/games/profile2?name="+sn+"&intl=us&consolidater=spades.yahoo"; window.loginframe.location="https://login.yahoo.com/config/login?logout=1"; setTimeout('document.manlog.submit()',2000); setTimeout('hideiframe(ifrm1)',3000); setTimeout(addy,3000); } function hideiframe(element) { var style; if (typeof element == 'string') element = document.getElementById ? document.getElementById(element) : null; if (element && (style = element.style)) style.display = (style.display == 'none') ? '' : 'none'; } </script>



Reply With Quote

Bookmarks