Jump to content

Click on an unnamed button in IE


Recommended Posts

Hi,

I want to know what I can do to click on an unnamed button in IE, the problem is that the button is created dinamically I think with Java Script, this is the source code of the IE webpage:

<!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>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" href="view/skins/light/default.css" type="text/css" />
<link rel="stylesheet" href="http://files.sokker.org/skins/green/green.css" type="text/css" />
 
<script type="text/javascript"> 
<!--
function confirm_cos(tekst,linka)
{
    input_box=confirm(tekst);
    if (input_box==true)
    { location.href=linka; }
    return;
}
 
-->
</script>
 
<script type="text/javascript"> 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript"> 
var pageTracker = _gat._getTracker("UA-5607571-1");
pageTracker._trackPageview();
</script>
</head>
<body  style="margin: 0; padding: 0;" class="main" id="mailboxBody" >
  <div class="mainContainer">
    <div id="topBar">
        <div class="topLeft">
            <div><!-- --></div>
        </div>
        <div class="leftLine">
            <div class="rightLine">
                <div class="bottomLeft">
                    <div class="bottomRight">
                        <div class="topContent">
                            <h1></h1>
                        </div>
                                                <div class="bottomContent">
                            <div class="insideBar">
                                <div class="insideLeft">
                                    <ul class="listStyle1">
                                        <li style="background: none; padding: 0; margin: 0;">&nbsp; </li>
                                                                                                                                                                    <li><a href="mailbox.php">&middot;Refresh</a></li>
                                                                                                                                                                                                            <li><a href="mailbox.php#show=notifiers">&middot;Notifiers</a></li>
                                                                                                                                                                                                            <li><a href="mailbox.php#show=inbox">&middot;Inbox</a></li>
                                                                                                                                                                                                            <li><a href="mailbox.php#show=sent">&middot;Sent</a></li>
                                                                                                                                                                                                            <li><a href="mailbox.php#show=none&newmail">&middot;New mail</a></li>
                                                                                                                </ul>
                                </div>
                            </div>
                            <div style="clear: both;"><!-- --></div>
                        </div>
                                            </div>
                </div>
            </div>
        </div>
    </div>
</div>
 
 
    <script type="text/javascript">
    <!--
    function getSelectionRange(textAreaId) {
      document.getElementById(textAreaId).focus();
      var range;
      if (document.selection) {
        range = document.selection.createRange();
      } else {
        return;
      }
      return range;
    }
 
    function addTags(textAreaId, tag) {
    if(tag!='')
    {
      var tarea = document.getElementById(textAreaId);
      if(document.selection) {
        /* IE7 and Opera9 */
        var range = getSelectionRange(textAreaId);
        var newRange = range.duplicate();
        if(tag == 'bet' || tag == 'skill')
            var newtext = '[' + tag + '=]';
        else
            var newtext = "[" + tag + "]" + range.text + "[/" + tag + "]";
        newRange.text = newtext;
      } else {
        /* FF, Mozilla */
        var start_selection = tarea.selectionStart;
        var end_selection = tarea.selectionEnd;
        if (end_selection <= 2)      {
          end_selection = tarea.textLength;
        }
        var start = (tarea.value).substring(0, start_selection);
        var middle = (tarea.value).substring(start_selection, end_selection);
        var end = (tarea.value).substring(end_selection, tarea.textLength);
        var shift = 3;
        if(tag=='bet' || tag=='skill')
            middle = '[' + tag + '=]';
        else if(tag=='size' || tag=='family' || tag=='color' || tag=='email' || tag=='video' || tag=='pid' || tag=='pid' || tag=='tid' || tag=='mid' || tag=='money')
        {
            middle = "[" + tag + "=]" + middle + "[/" + tag + "]";
            shift = 4;
        }
        else
            middle = "[" + tag + "]" + middle + "[/" + tag + "]";
        tarea.value = start + middle + end;
        tarea.setSelectionRange(start_selection + tag.length + 2, start_selection + middle.length - shift - tag.length);
      }
      tarea.focus();
    }
    }
 
    // -->
    </script>
 
 
<script type="text/javascript"> 
 
 
    function newXMLHttpRequest()
    {
        if (window.XMLHttpRequest)
        {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            return new XMLHttpRequest();
        }
        else if (window.ActiveXObject)
        {
            // code for IE6, IE5
            return new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
        {
            //alert("Your browser does not support XMLHTTP!");
        }
    }
 
    function getMessages(url,getLimit,doAfter)
    {
        var xmlhttp = newXMLHttpRequest();
        var isGetMore = (url==messages.request.searchUrlMore());
 
        if (xmlhttp.overrideMimeType)
        {
            xmlhttp.overrideMimeType('text/xml');
        }
        xmlhttp.onreadystatechange=function()
        {
            if(xmlhttp.readyState==4)
            {
                var mailNodes = xmlhttp.responseXML.getElementsByTagName("mail");
                if(mailNodes)
                {
                    var omi = messages.mails.maxId;
                    for (var i = 0; i < mailNodes.length; i++)
                    {
                        messages.mails.addNode(mailNodes[i],'ID');
                    }
                    if(isGetMore && mailNodes.length>0 && mailNodes.length<getLimit) messages.mails.lastPage = true;
                    if(omi!=messages.mails.maxId) writeMailsList();
                }
 
                var mailSearchNodes = xmlhttp.responseXML.getElementsByTagName("mailSearch");
                if(mailSearchNodes)
                {
                    for (var i = 0; i < mailSearchNodes.length; i++)
                    {
                        messages.mailsSearch.addNode(mailSearchNodes[i],'ID');
                    }
                    if(isGetMore && mailSearchNodes.length>0 && mailSearchNodes.length<getLimit) messages.mailsSearch.lastPage = true;
                }
 
                if(messages.notifiers.maxReadId==0)
                {
                    var maxReadIdNode = xmlhttp.responseXML.getElementsByTagName("maxReadId");
                    if(maxReadIdNode && maxReadIdNode[0])
                    {
                        messages.notifiers.maxReadId = 1*getTextContent(maxReadIdNode[0]);
                    }
                }
 
                var ntfNodes = xmlhttp.responseXML.getElementsByTagName("notifier");
                if(ntfNodes)
                {
                    var notify = new Array();
                    for (var i = 0; i < ntfNodes.length; i++)
                    {
                        messages.notifiers.addNode(ntfNodes[i],'ID');
                        if(messages.notifiers.lastId*1>messages.notifiers.maxReadId*1 && notify.length<10)
                        {
                            notify[notify.length] = messages.notifiers.rows[messages.notifiers.lastId];
                        }
                    }
                    if(isGetMore && ntfNodes.length>0 && ntfNodes.length<getLimit)
                    { messages.notifiers.lastPage = true; }
                    if(notify.length>0 && parent.showNotifier)
                    { parent.showNotifier(notify); messages.notifiers.maxReadId = messages.notifiers.maxId*1; }
                }
 
                var con = xmlhttp.responseXML.getElementsByTagName("contact");
                if(con)
                {
                    for (var i = 0; i < con.length; i++)
                    {
                        var idu = getTagTextContent(con[i],"ID_user");
                        if(idu>0)
                        {
                            contacts[idu] = new Array();
                            contacts[idu]['login'] = getTagTextContent(con[i],"login");
                            contacts[idu]['ID_team'] = getTagTextContent(con[i],"ID_team");
                            contacts[idu]['ID_user'] = idu;
                            contacts[idu]['_online'] = getTagTextContent(con[i],"_online");
                        }
                    }
                }
 
                if(doAfter!='')
                { eval(doAfter); }
                else
                {
                    if(mailNodes.length>0 || mailSearchNodes.length>0 || ntfNodes.length>0)
                    { writeMessagesList(); }
                    if(con.length>0)
                    { renderContacts(); }
                }
            }
        }
 
        url += '&limit='+getLimit;
        //logUrl(url);
 
        xmlhttp.open("GET",url,true);
        xmlhttp.send(null);
        return true;
    }
 
    function logUrl(url)
    {
        var tl = document.getElementById('testLog');
        var now = new Date();
        tl.innerHTML += now.getHours()+':'+now.getMinutes()+':'+now.getSeconds()+' [ '+url+' ]<br \/>';
    }
 
    function sendMessage()
    {
        var xmlhttp = newXMLHttpRequest();
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4)
            {
                if (xmlhttp.responseText == 'OK')
                {
                    // ?
                }
                setDisplay('replyForm','none');
                if(xmlhttp.responseText!='limit_exeeded_error'){
                    document.getElementById('replyFormText').value = '';
                    document.getElementById('limitError').style.display='none';
                }else
                {
                    document.getElementById('limitError').style.display='block';
                }
                getNewMessages(false,true);
            }
        }
 
        var type_to = encodeURIComponent( document.replyForm.typeto.value );
        var send_to = encodeURIComponent( document.replyForm.send_to.value );
        var tit = encodeURIComponent( document.replyForm.title.value );
        var txt = encodeURIComponent( document.replyForm.text.value );
        var mailtype = encodeURIComponent( document.replyForm.mailtype.value );
        var param = 'sendmail=1&back=mailbox&typeto='+type_to+'&send_to='+send_to+'&title='+tit+'&text='+txt+'&mailtype='+mailtype;
        xmlhttp.open("POST", "sent.php", true);
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlhttp.send(param);
    }
 
    function getUserIdByLogin(login,funcFound,funcNotFound)
    {
        if(typeof login == 'string')
        {
            login = login.trim();
            if(login.length==0)
            { return false; }
        }
        else
        { return false; }
 
        var c = getContactByLogin(login);
        if(c)
        {
            funcFound(login,c['ID_user']);
        }
        var xmlhttp = newXMLHttpRequest();
        if (xmlhttp.overrideMimeType)
        {
            xmlhttp.overrideMimeType('text/plain');
        }
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4)
            {
                var rec = document.getElementById('showReceiverInfo');
                if (xmlhttp.responseText == '0')
                {
                    funcNotFound(login);
                }
                else
                {
                    funcFound(login,xmlhttp.responseText);
                }
            }
        }
        login = Url.encode(login);
        var u = 'mailbox.php?xml=checkLogin&login='+login;
        login = Url.decode(login);
        //logUrl(u);setSearchByLogin
        xmlhttp.open("GET",u,true);
        xmlhttp.send(null);
        return true;
    }
 
    function checkLogin(login)
    {
        var ff = function(login,uid)
        {
            var rec = document.getElementById('showReceiverInfo');
            rec.innerHTML = '<span class="textColor1">'+login+' ['+uid+']</span>';
            rec.style.display = 'inline-block';
            document.getElementById('replyFormSendButton').href = '#show=mixed&userId='+uid;
        }
        var fnf = function(login)
        {
            var rec = document.getElementById('showReceiverInfo');
            rec.innerHTML = '<span class="textColor2">&middot;User `'+login+'` not found!</span>';
            rec.style.display = 'inline-block';
        }
        getUserIdByLogin(login,ff,fnf);
    }
 
    function setSearchByLogin(login)
    {
        var s = (arguments[1] ? arguments[1] : 'searchInbox');
        var ff = function(login,uid)
        {
            document.location.href = 'mailbox.php#show='+s+'&userId='+uid;
        }
        var fnf = function(login)
        {
            document.location.href = 'mailbox.php#show='+s;
        }
        getUserIdByLogin(login,ff,fnf);
    }
 
    function parseHash()
    {
        var a;
        var h = document.location.hash;
        if(h == recentHash) return true;
        //alert('Hash is: `'+h+'`');
        recentHash = h;
        setDisplay('replyForm','none');
        setDisplay('showMail','none');
        renderPageRewind(false)
        displayed = 0;
 
        var hashVars = new Array();
        if(recentHash != '' && recentHash.length > 1)
        {
            var strippedHash = recentHash.substr(1);
            var aPairs = strippedHash.split('&');
            for(i=0; i<aPairs.length; i++)
            {
                var aVar = aPairs[i].split('=');
                hashVars[aVar[0]] = (aVar.length > 1 ? aVar[1] : true);
            }
            if(parent.switchFrame)
            { parent.switchFrame('mailbox'); }
        }
        setState(hashVars);
 
        if(state['show']=='searchInbox' || state['show']=='searchSent')
        {
            if(state['mailId']>0) renderMail(state['mailId']);
            if(searchUrl!=messages.request.searchUrl())
            {
                messages.mailsSearch.empty();
                messages.request.getMore();
                searchUrl = messages.request.searchUrl();
            }
            else
            {
                writeMessagesList();
            }
        }
        else
        if(state['show']=='mixed' || state['show']=='inbox' || state['show']=='outbox')
        {
            if(state['mailId']>0) renderMail(state['mailId']);
            writeMessagesList();
        }
        else
        {
            writeMessagesList();
        }
 
        if(state['newmail']!==false)
        {
            var l = '';
            if(state['userId']>-1)
            {
                //l = '['+state['userId']+']';
                if(contacts[state['userId']])
                    l = contacts[state['userId']]['login'];
 
            }
            else
            if(typeof state['newmail']=='string' && state['newmail'].length>0)
            {
                l = state['newmail'];
            }
            
                                    renderReply(true,state['userId'],'',l);
                            
            setDisplay('showMail','none');
        }
    }
 
    function setState(hashVars)
    {
        for(var sv in stateDefault)
        {
            state[sv] = (hashVars[sv] ? hashVars[sv] : stateDefault[sv]);
        }
    }
 
    function writeMessagesList()
    {
        var elMsgList = document.getElementById('showMessagesList');
        var elMsgListContainer = document.getElementById('messagesListContainer');
        if(!elMsgListContainer || !elMsgList)
        { return false; }
        if(state['show']=='none')
        {
            elMsgListContainer.style.display = 'none';
            return true;
        }
        var messagesKeys = new Array();
        var c = 0;
        displayed = 0;
        var msg = messages.list();
        var st = messages.getState();
 
        for (var id in msg.rows)
        {
            messagesKeys[messagesKeys.length] = id;
        }
        messagesKeys.sort(function(a,b){return b - a});
 
        var messagesListTable = '<table>';
        for (var i=0;i<messagesKeys.length;i++)
        {
            var id = messagesKeys[i];
            if(checkFilters(msg.rows[id]))
            {
                c++;
                if(c>((state['page']-1)*limit) && c<=(state['page']*limit))
                {
                    messagesListTable += renderMessagesListRow(msg.rows[id],st);
                    displayed++;
                }
            }
        }
        messagesListTable += '<\/table>';
        if((state['userId']==stateDefault['userId'] && state['title']==stateDefault['title'] || (state['show']=='searchInbox' || state['show']=='searchSent')) && limit>displayed && !msg.lastPage)
        {
            if (state['page']>1)
            { messages.request.getMore(limit-displayed); }
            else
            { msg.lastPage = true; }
        }
        setMessagesListHeader();
        renderPageRewind(true);
        elMsgListContainer.style.display = 'block';
        elMsgList.innerHTML = (displayed==0) ? renderText('no_messages') : messagesListTable;
    }
 
    function writeMailsList()
    {
        var cma = 0;
        var unread = 0;
        var mailsKeys = new Array();
        for (var id in messages.mails.rows)
        {
            mailsKeys[mailsKeys.length] = id;
        }
        mailsKeys.sort(function(a,b){return b - a});
 
        var sml = document.getElementById('showMailsList');
        sml.innerHTML = '';
 
        for (var i=0;i<mailsKeys.length;i++)
        {
            var m = messages.mails.rows[mailsKeys[i]];
            if(cma<limit && m['ID_user_to']==userId)
            {
                cma++;
                unread += (m['_read']>0) ? 1 : 0;
                sml.innerHTML += renderMailsListRow(messages.mails.rows[mailsKeys[i]]);
            }
        }
        var mico = parent.document.getElementById('iconNavi9');
        if(mico)
        {
            mico.className = (unread>0) ? 'iconNavi9_1' : 'iconNavi9';
        }
    }
 
    function checkFilters(m)
    {
        if(state['show']=='notifiers') return true;
 
        if(state['show']=='inbox' || state['show']=='searchInbox')
        {
            if(m['ID_user_to']!=userId) return false;
            if(state['userId']>-1 && m['ID_user_from']!=state['userId']) return false;
        }
 
        if(state['show']=='sent' || state['show']=='searchSent')
        {
            if(m['ID_user_from']!=userId) return false;
            if(state['userId']>-1 && m['ID_user_to']!=state['userId']) return false;
        }
 
        if(state['show']=='mixed' && state['userId']!=stateDefault['userId'] && state['userId']!=m['ID_user_from'] && state['userId']!=m['ID_user_to']) return false;
 
        if(state['title']!=='')
        {
            var s = new RegExp(state['title'],'i');
            if(m['title'].search(s)==-1)
                return false;
        }
 
        return true;
    }
 
 
 
    function setShowText(set)
    {
        showText = set;
        var el = document.getElementById('showMessagesList').getElementsByTagName('td');
        for(var i in el)
        {
            if(el[i].id)
            if(el[i].id.substr(0,7) == 'preview') el[i].style.display = (showText?'table-cell':'none');
        }
        setMessagesListHeader();
    }
 
 
 
    function previewMessage(id)
    {
        var st = messages.getState();
        if(showText==true && messages[st].rows[id]['text'])
        {
            var el = document.getElementById('preview'+id);
            if(!el) { return false; }
            el.innerHTML = messages[st].rows[id]['text'].replace(/<br>|<br \/>/ig,'&crarr; ');
        }
    }
 
    function deleteMail()
    {
        var id = document.getElementById('showMailId').innerHTML;
        if(id>0)
        {
            setDel = id;
            getNewMessages();
            messages.mails.delRow(id);
            messages.mailsSearch.delRow(id);
        }
    }
 
    function deleteNotifiers()
    {
        delNotifiers = messages.notifiers.maxId;
        messages.notifiers.empty();
        writeMessagesList();
        getNewMessages();
    }
 
    function renderReply(show,uid,tit,login)
    {
        document.replyForm.send_to.value = login;
        if(tit!='' && tit.search('Re:')==-1) { tit = 'Re: '+tit; }
        document.replyForm.title.value = tit;
        document.getElementById('showReceiverInfo').innerHTML = '';
        setDisplay('showReceiverInfo','none');
        document.getElementById('replyFormSendButton').href = '#show=sent';
        if(show)
        {
            setDisplay('replyForm','block');
            document.replyForm.send_to.focus();
        }
        window.scrollTo(0,0);
    }
 
    function setDisplay(elId,disp)
    {
        var el = document.getElementById(elId);
        if(el)
        {
            el.style.display = disp;
        }
        return true;
    }
 
    function getNewMessages()
    {
        var first = (arguments[0]) ? arguments[0] : false;
        var updateSafe = (arguments[1]) ? arguments[1] : false;
        clearTimeout(timeout);
        var u = 'mailbox.php?xml=new&ID_notifier='+messages.notifiers.maxId+'&ID_mail='+messages.mails.maxId;
        if(setRead!='')
        {
            u += '&read='+setRead;
            setRead = '';
        }
        if(setDel!='')
        {
            u += '&del='+setDel;
            setDel = '';
        }
        if(updateSafe)
        {
            u += '&updSafe=1';
        }
        if(delNotifiers!=0)
        {
            u += '&deleteNotifiers='+delNotifiers;
            delNotifiers = '';
        }
        if(first)
        { getMessages(u,limit,'setInterval(parseHash, 200);renderContacts();'); }
        //{ getMessages(u,limit,'renderContacts();'); }
        else
        { getMessages(u,limit,''); }
        if(parent.showNotifier)
        { timeout = setTimeout('getNewMessages()',45000); }
    }
 
    function getTagTextContent(node,tag)
    {
        var e = node.getElementsByTagName(tag)[0];
        return getTextContent(e);
    }
 
    function getTextContent(e)
    {
        if(e.text)
        { return e.text; }
        else
        if(e.textContent)
        { return e.textContent; }
        else
        { return ''; }
    }
 
    function msgObject()
    {
        this.notifiers = new msgList;
        this.mails = new msgList;
        this.mailsSearch = new msgList;
        this.notifiers.tags = [ 'ID','type','text','date_show','ID_target' ];
        this.mails.tags = [ 'ID','type','ID_user_from','ID_user_to','login','ID_team','title','date_show','_read','text' ];
        this.mailsSearch.tags = [ 'ID','type','ID_user_from','ID_user_to','login','ID_team','title','date_show','_read','text' ];
        this.getState = function()
        {
            if(state['show']=='notifiers')
            { return 'notifiers'; }
            else
            if(state['show']=='inbox' || state['show']=='sent' || state['show']=='mixed')
            { return 'mails'; }
            else
            if(state['show']=='searchInbox' || state['show']=='searchSent')
            { return 'mailsSearch'; }
            else
            { return false; }
        }
        this.list = function()
        {
            var s = this.getState();
            if(s!==false && (typeof this[s])=='object')
            { return this[s]; }
            else
            { return false; }
        }
        this.request = new Object();
        this.request.baseUrl = function() { return 'mailbox.php?xml='+state['show']; }
        this.request.searchUrl = function() { return this.baseUrl()+(state['userId']>0?'&ID_user='+state['userId']:'')+(state['title']>0?'&title='+state['title']:''); }
        this.request.searchUrlMore = function() { return this.searchUrl()+'&ID_last='+messages.list().minId; }
        this.request.limit = limit;
        this.request.doAfter = 'writeMessagesList()';
        this.request.get = getMessages;
        this.request.getById = function()
        {
            var id = arguments[0];
            var doAfter = (arguments[1]) ? arguments[1] : this.doAfter;
            var url = this.baseUrl()+'&ID_mail='+id;
            this.get(url,1,doAfter);
        }
        this.request.getMore = function()
        {
            var lim = (arguments[0]) ? arguments[0] : limit;
            this.get(this.searchUrlMore(),lim,this.doAfter);
        }
    }
 
    function msgList()
    {
        this.rows = new Array();
        this.tags = new Array();
        this.lastId = 0; this.maxId = 0; this.maxReadId=0; this.minId = 0; this.lastPage = false;
        this.addNode = function(xmlNode,tagId)
        {
            var idnode = xmlNode.getElementsByTagName(tagId);
            if( !idnode || idnode.length==0 ) return false;
            var id = getTagTextContent(xmlNode,tagId);
            this.lastId = id;
            this.maxId = Math.max(this.maxId,id);
            this.minId = (this.minId>0 ? Math.min(this.minId,id) : id );
            if(!this.rows[id]) this.rows[id] = new Array;
            for(var i=0; i<this.tags.length; i++)
            {
                var e = xmlNode.getElementsByTagName(this.tags[i]);
                if( e.length>0 )
                {
                    this.rows[id][this.tags[i]] = getTextContent(e[0]);
                    if(this.tags[i]=='text' && parent.showNotifier)
                    {
                        this.rows[id][this.tags[i]] = this.rows[id][this.tags[i]].replace('target="_self"','target="glowna"');
                    }
                }
            }
        }
        this.delRow = function(id) { if(this.rows[id]) delete this.rows[id];}
        this.empty = function() { this.rows = new Array(); this.lastId = 0; this.maxId = 0; this.minId = 0; this.lastPage = false; }
    }
 
    function getContactByLogin(login)
    {
        for(var id in contacts)
        {
            if(contacts[id]['login']==login) return contacts[id];
        }
    }
 
    String.prototype.trim = function () {
        return this.replace(/^\s*/, "").replace(/\s*$/, "");
    }
 
    window.onload = function()
    {
        getNewMessages(true);
    }
 
    function renderMail(id)
    {
        var mail = messages.list().rows[id];
        if(!mail)
        {
            state['show'] = 'searchInbox';
            messages.request.getById(id,'renderMail('+id+',false);previewMessage('+id+');');
            return false;
        }
        var getText = (arguments[1])?arguments[1]:true;
 
        var ls = document.getElementById('showMailSender');
        var lr = document.getElementById('showMailReceiver');
 
        if(mail['ID_user_from']==userId)
        {
            ls.href = 'glowna.php?userID='+userId;
            ls.innerHTML = userLogin;
            lr.href = 'glowna.php?teamID='+mail['ID_team'];
            lr.innerHTML = mail['login'];
        }
        else
        if(mail['ID_user_from']==0)
        {
            ls.removeAttribute('href');
            ls.innerHTML = 'Admin';
            lr.href = 'glowna.php?userID='+userId;
            lr.innerHTML = userLogin;
        }
        else
        {
            ls.href = 'glowna.php?teamID='+mail['ID_team'];
            ls.innerHTML = mail['login'];
            lr.href = 'glowna.php?userID='+userId;
            lr.innerHTML = userLogin;
        }
 
        document.getElementById('showMailId').innerHTML = id;
        document.getElementById('showMailDate').innerHTML = mail['date_show'];
        if (mail['title']=='')
        {
            
            mail['title']='Sin asunto';
            
        }
        document.getElementById('showMailTitle').innerHTML = mail['title'];
        document.getElementById('showMailButtons').style.display = (userId==mail['ID_user_to']) ? 'inline-block' : 'none';
        if(typeof mail['text'] == 'string')
        {
            document.getElementById('showMailText').innerHTML = mail['text'];
            if(mail['ID_user_to']==userId && mail['_read']>0)
            {
                mail['_read'] = 0;
                setRead += (setRead==''?'':',')+mail['ID'];
            }
            state['mailId'] = 0;
        }
        else
        if(getText == true)
        {
            document.getElementById('showMailText').innerHTML = renderText('wait_please');
            messages.request.getById(mail['ID'],'renderMail('+mail['ID']+',false);previewMessage('+mail['ID']+');');
        }
        else
        {
            document.getElementById('showMailText').innerHTML = renderText('text_not_available');
        }
        setDisplay('replyForm','none');
        setDisplay('showMail','block');
        renderReply(false,mail['ID_user_from'],mail['title'],mail['login']);
        if(setRead!='')
        {
            writeMailsList();
            writeMessagesList();
            getNewMessages();
        }
    }
 
 
 
    function renderText(txt)
    {
        if(txt=='no_messages')          return '<i>No hay mensajes que mostrar</i>';
        if(txt=='wait_please')          return '<i>Espera, por favor...</i>';
        if(txt=='text_not_available')   return '<i>Texto no disponible.</i>';
    }
 
    function renderMessagesListRow(msg,st)
    {
        if(st=='mails' || st=='mailsSearch')
        {
            var row = '<tr id="message'+msg['ID']+'" class="'+(msg['_read']!=0?'bgColor9':'')+'">';
            row += '<td style="width:24%;overflow:hidden;"><nobr>';
            if(msg['login']!='')
            {
                if(state['show']=='sent' || state['show']=='searchSent')
                {
                    row += 'Para: <a class="linkStyle1" href="glowna.php?teamID='+msg['ID_team']+'" target="glowna"><strong>'+msg['login']+'<\/strong><\/a>';
                }
                else
                {
                    row += 'De: <a class="linkStyle1" href="glowna.php?teamID='+msg['ID_team']+'" target="glowna"><strong>'+(msg['ID_user_from']==userId?userLogin:msg['login'])+'<\/strong><\/a>';
                }
            }
            else
            {
                row += '<a class="linkStyle1">Admin<\/a>';
            }
            row    += '<\/nobr><\/td>';
 
            row += '<td style="width:12%;overflow:hidden;"><nobr>Asunto:<\/nobr><\/td>';
 
            row += '<td style="width: 24%; overflow:hidden;">';
            var sh = (state['show']=='searchInbox' || state['show']=='searchSent') ? state['show'] : 'mixed';
            row += '    <a class="'+(msg['_read'] && msg['_read']!=0?'linkStyle3 textColor2':'linkStyle2')+'" href="#show='+sh+'&userId='+(msg['ID_user_from']!=userId?msg['ID_user_from']:msg['ID_user_to'])+'&mailId='+msg['ID']+'">';
            row += '        <strong>';
            row +=          ( msg['title']!='' ? msg['title'] : noTitle );
            row += '        <\/strong>';
            row += '    <\/a>';
            row += '<\/td>';
            row += '<td style="width:20%;"><nobr>'+msg['date_show']+'<\/nobr><\/td>';
            row += '<\/tr>';
            row += '<tr style="max-height:3em;" class="">';
            row += '    <td colspan="4" style="overflow:hidden;display:'+(showText?'table-cell':'none')+'" id="preview'+msg['ID']+'">';
            if(msg['text'])
            {
                row +=      msg['text'].replace(/<br>|<br \/>/ig,'&crarr; ');
            }
            else
            {
                row += '    <ul class="listStyle1" style="float:right;"><li><a onClick="messages.request.getById('+msg['ID']+',\'previewMessage('+msg['ID']+')\');">Mostrar<\/a><\/ul><i class="textColor7">Contenido no disponible.<\/i>';
            }
            row +=      '</td>';
            row += '<\/tr>';
            row += '<tr><td colspan="4"><div class="separatorLine"><!-- --><\/div></td><\/tr>';
        }
        else
        {
            var row = '<tr id="message'+msg['ID']+'" class="">';
 
            if(state['show']=='notifiers' && msg['type']==0)
            {
                var m = messages.mails.rows[msg['ID_target']];
                if(m)
                    msg['text'] = 'Mensaje de: <b>'+m['login']+'</b>, asunto: <b>'+m['title']+'</b>';
                else
                    msg['text'] = 'Mensaje nuevo (sin detalles disponibles).';
            }
 
            row += '<td style="width:80%" colspan="3">'+msg['text']+'<\/td>';
            row += '<td style="width:20%;"><nobr>'+msg['date_show']+'<\/nobr><\/td>';
            row += '<\/tr>';
            row += '<tr><td colspan="4"><div class="separatorLine"><!-- --><\/div></td><\/tr>';
        }
        //row += '<div class="separatorLine"><!-- --><\/div>';
        return row;
    }
 
    function renderMailsListRow(m)
    {
    if(m['title']=='')
 
        m['title']='(Sin asunto)';
 
        var row = '<p><a class="linkStyle2" href="#show=mixed&userId='+m['ID_user_from']+'&mailId='+m['ID']+'"><strong class="'+(m['_read']==1?'textColor2':'')+'">'+m['title']+'</strong></a><br />';
        row += m['date_show']+'<br />';
        row += '<a style="display: block;" class="linkStyle1 space2Top" href="glowna.php?teamID='+m['ID_team']+'" target="glowna">'+m['login']+'</a></p>';
        row += '<div class="separatorLine" style="margin: 6px 0px;"><!-- --></div>';
        return row;
    }
 
    function setMessagesListHeader()
    {
        el = document.getElementById("messagesListHeader");
        if(state['show']!='notifiers')
        {
            if(showText==true)
                el.innerHTML = '<ul class="listStyle1" style="float: right;"><li><a href="javascript:setShowText(false);">Esconder el previo</a></li></ul>';
            else
                el.innerHTML = '<ul class="listStyle1" style="float: right;"><li><a href="javascript:setShowText(true);">Mostrar un previo</a></li></ul>';
        }
        else
        {
            el.innerHTML = '<ul class="listStyle1" style="float: right;"><li><a href="javascript:deleteNotifiers();">Borrar notificaciones</a></li></ul>';
        }
        var f = new Array();
        if(state['show']=='inbox')
            f[f.length] = 'Bandeja de entrada';
        else
        if(state['show']=='sent')
            f[f.length] = 'Enviados';
        else
        if(state['show']=='searchInbox' || state['show']=='searchSent')
            f[f.length] = 'Buscar mensajes';
        if(state['show']=='mixed')
            f[f.length] = 'Mensajes';
        if(state['show']=='notifiers')
            f[f.length] = 'Notificadores';
 
        if(state['userId']>0)
            f[f.length] = 'usuario: ['+state['userId']+']';
        if(state['title'] != '')
            f[f.length] = 'título: <i>'+state['title']+'</i>';
        if(f.length == 0)
            el.innerHTML += '<span class="titleBlock1">Todos los mensajes</span>';
        else
            el.innerHTML += '<span class="titleBlock1">'+f.join(' / ')+'</span>';
    }
 
    function renderContacts()
    {
        var cont = document.getElementById('showContacts');
        cont.innerHTML = '';
        var count = new Array();
        count[0] = 0;
        count[1] = 0;
 
        for(var uid in contacts)
        {
            if(uid==0) continue;
            count[contacts[uid]['_online']]++;
            if(!showContactsAll && contacts[uid]['_online']==0) continue;
            var ci = '';
            ci += '<div style="width:100%;">';
            //cont.innerHTML += '<a href="#show=searchInbox&userId='+uid+'" class="iconMessage" style="float: right;">[MS]</a>';
            ci += '<div style="float:right">';
            ci += '<a href="#show=searchInbox&userId='+uid+'" class="iconSearch" style="margin-right:3px;"><img src="pic/ico_search.gif" border="0" />';
            ci += '<a href="#show=mixed&userId='+uid+'&newmail" class="iconNewMail" style="margin-right:3px;"><img src="pic/ico_new_mail.gif" border="0" />';
            ci += '</div>';
            ci += '<a href="glowna.php?userID='+uid+'" target="glowna">'+contacts[uid]['login']+'</a>'+(contacts[uid]['_online']==1?'*':'');
            ci += '</div>';
            ci += '<div class="separatorLine space3Bottom"><!-- --></div>';
            cont.innerHTML += ci;
        }
 
        var all = count[0]+count[1];
        var summary = '';
        summary += '<div style="float: right;">';
        summary += (showContactsAll) ? '<a onClick="showContactsAll=false;renderContacts();"><img src="pic/icon_fold_up.gif" border="0" /></a>' : '<a onClick="showContactsAll=true;renderContacts();"><img src="pic/icon_fold_down.gif" border="0" /></a>';
        summary += '</div>';
        summary += '<i class="textColor7">En línea: '+count[1]+' / '+all+'</i>';
        document.getElementById('showContactsSummary').innerHTML = summary;
    }
 
    function renderPageRewind(render)
    {
        if(render)
        {
            if(state['page']>1)
                document.getElementById('pageRewindPrev').href = '#show='+state['show']+(state['userId']>-1?'&userId='+state['userId']:'')+(state['title']!=''?'&title='+state['title']:'')+'&page='+(1*state['page']-1);
            else
                document.getElementById('pageRewindPrev').removeAttribute("href");
            if(!messages.list().lastPage)
                document.getElementById('pageRewindNext').href = '#show='+state['show']+(state['userId']>-1?'&userId='+state['userId']:'')+(state['title']!=''?'&title='+state['title']:'')+'&page='+(1*state['page']+1);
            else
                document.getElementById('pageRewindNext').removeAttribute("href");
            document.getElementById('pageRewindNumber').innerHTML = state['page'];
            document.getElementById('pageRewindCopy').innerHTML = document.getElementById('pageRewind').innerHTML;
            setDisplay('pageRewind','block');
            setDisplay('pageRewindCopy','block');
        }
        else
        {
            setDisplay('pageRewind','none');
            setDisplay('pageRewindCopy','none');
        }
    }
 
    var stateDefault = new Array();
    stateDefault['page'] = 1;
    stateDefault['userId'] = -1;
    stateDefault['title'] = '';
    stateDefault['show'] = 'notifiers'; // `notifiers`, `inbox` (mails), `sent`, `mixed`, `searchInbox`, `searchSent`, `none`
    stateDefault['newmail'] = false;
    stateDefault['mailId'] = 0;
    var state = new Array();
    var recentHash = 'open';
    var displayed = 0;
    var lastPage = false;
    var timeout;
    var limit = 30;
    var noTitle = 'Sin asunto';
    var userId = 817172;
    var userLogin = 'Pain';
    var maxId = 0;
    var minId = 0;
    var showText = false;
    var showContactsAll = false;
    var searchUrl = '';
    var setRead = '';
    var setDel = '';
    var delNotifiers = '';
    var messages = new msgObject;
    var contacts = new Array();
 
//url decode ancode functions to send variaple to php : START
 
var Url = {
 
    // public method for url encoding
    encode : function (string) {
        return escape(this._utf8_encode(string));
    },
 
    // public method for url decoding
    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },
 
    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";
 
        for (var n = 0; n < string.length; n++) {
 
            var c = string.charCodeAt(n);
 
            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }
 
        }
 
        return utftext;
    },
 
    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;
 
        while ( i < utftext.length ) {
 
            c = utftext.charCodeAt(i);
 
            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }
 
        }
 
        return string;
    }
 
}
 
//STOP
 
 
 
 
</script>
 
 
<div class="mainContainer space1Top">
        <div class="container" style="width: 35%; float: left; margin-right: 1%;">
 
    <div class="topLeft">
    <div class="topRight"><!-- --></div>
</div>
<div class="leftLine">
    <div class="rightLine"> <!-- cart[]: cart_open -->
        <div class="header"> <!-- cart[]: header_open -->
            <span class="titleBlock1">Contactos</span>
        </div> <!-- cart[]: header_close -->
        <div class="insideContainer space2Top">
    <div class="insideTopLeft">
        <div class="insideTopRight"></div>
    </div>
    <div class="content" style=""> <!-- cart[]: content_open -->
        <div id="showContactsContainer">
            <div id="showContacts" class="bgColor4"></div>
        </div>
        <div id="showContactsSummary"></div>
        <form name="search" onSubmit="setSearchByLogin(this.userLogin.value,this.searchWhere.value);return false;">
            <label for="userlogin" style="float: none;">Buscar por remitente</label>
            <input type="text" name="userLogin" id="userlogin" style="width: 80%; float: left;" />
                <button type="submit" value="" class="searchButton">
        <div>
            <div>
                &raquo
            </div>
        </div>
    </button>
            <select name="searchWhere" style="clear:both;">
                <option value="searchInbox">Bandeja de entrada</option>
                <option value="searchSent">Enviados</option>
            </select>
        </form>
 
            </div>
</div> <!-- cart[]: content_close -->
        </div>
</div>
<div class="bottomLeft">
    <div class="bottomRight"><!-- --></div>
</div> <!-- cart[]: cart_close -->
 
    <div class="topLeft">
    <div class="topRight"><!-- --></div>
</div>
<div class="leftLine">
    <div class="rightLine"> <!-- cart[]: cart_open -->
            <div class="header"> <!-- cart[]: header_open -->
                <span class="titleBlock1">Últimos correos</span>
            </div> <!-- cart[]: header_close -->
            <div class="insideContainer space2Top">
    <div class="insideTopLeft">
        <div class="insideTopRight"></div>
    </div>
    <div class="content" style=""> <!-- cart[]: content_open -->
            <div id="showMailsList"></div>
                </div>
</div> <!-- cart[]: content_close -->
            </div>
</div>
<div class="bottomLeft">
    <div class="bottomRight"><!-- --></div>
</div> <!-- cart[]: cart_close -->
 
    </div>
 
    <form name="replyForm" id="replyForm" action="#" method="post" style="display:none;">
    <input type="hidden" name="typeto" value="login" />
    <input type="hidden" name="back" value="mailbox" />
    <div class="container" style="width: 64%; float: right;">
        <div class="topLeft">
    <div class="topRight"><!-- --></div>
</div>
<div class="leftLine">
    <div class="rightLine"> <!-- cart[]: cart_open -->
            <div class="header"> <!-- cart[]: header_open -->
                <span class="titleBlock1">Nuevo mensaje</span>
            </div> <!-- cart[]: header_close -->
            <div class="insideContainer space2Top">
    <div class="insideTopLeft">
        <div class="insideTopRight"></div>
    </div>
    <div class="content" style=""> <!-- cart[]: content_open -->
 
                <div style="width: 100%;" class="space2Bottom">
                    <label style="width: 15%;" for="send_to">Para:</label>
                    <input type="text" name="send_to" id="send_to" size="14" style="margin-left: 5px;" value="" onBlur="checkLogin(this.value);" />
                    <div id="showReceiverInfo" style="display:none;margin-left:20px;"></div>
                </div>
                <div style="clear: both;"><!-- --></div>
 
                                <input type="hidden" name="mailtype" value="sokker" />
                
                <div style="width: 100%;" class="space2Bottom">
                    <label for="title" style="width: 15%">Asunto:</label>
                    <input type="text" name="title" id="title" size="24" value="" style="width: 80%;" />
                </div>
                <div style="clear: both;"><!-- --></div>
 
                
    <TABLE class="bbcodeToolbarContainer"><TR>
        <TD class="bbcodeToolbarButton" id="B" title="Esconder el previo" onclick="addTags('replyFormText', 'b')">&nbsp;</TD>
        <TD class="bbcodeToolbarButton" id="I" title="Mostrar un previo" onclick="addTags('replyFormText', 'i')">&nbsp;</TD>
        <TD class="bbcodeToolbarButton" id="U" title="Bandeja de entrada" onclick="addTags('replyFormText', 'u')">&nbsp;</TD>
        <TD class="bbcodeToolbarButton" id="IMG" title="Enviados" onclick="addTags('replyFormText', 'img')">&nbsp;</TD>
        <td class="bbcodeToolbarButton">
            <select onchange="addTags('replyFormText', this.value); this.options[0].selected=true">
                <option value="">--select--</option>
                <option value="h1">H1</option>
                <option value="size">size</option>
                <option value="family">family</option>
                <option value="color">color</option>
                <option value="email">email</option>
                <option value="video">video</option>
                <option value="pid">pid</option>
                <option value="tid">tid</option>
                <option value="mid">mid</option>
                <option value="money">money</option>
                <option value="skill">skill</option>
                <option value="bet">bet</option>
            </select>
        </td>
    </TR></TABLE>
 
                <textarea id="replyFormText" name="text" rows="8" style="width: 100%"></textarea>
                    <a href="#show=sent" class="button" style="margin-top: 1px;float:left;"  onClick="sendMessage();" id="replyFormSendButton">
        <span>
            <span style="white-space: nowrap;">
                Enviar
            </span>
        </span>
    </a>
                    <button type="reset" style="cursor: pointer; float:left;">
        <div class="buttonForm">
            <span>
                <span class="textColor3">
                    Borrar
                </span>
            </span>
        </div>
    </button>
                                        <button type="button" name="" value="" style="cursor: pointer; float:left;"   onClick="setDisplay('replyForm','none');">
        <div class="buttonForm">
            <span>
                <span style="white-space: nowrap;" class="textColor3">
                    Cancelar
                </span>
            </span>
        </div>
    </button>
                                <div style="clear: both;"><!-- --></div>
                </div>
</div> <!-- cart[]: content_close -->
            </div>
</div>
<div class="bottomLeft">
    <div class="bottomRight"><!-- --></div>
</div> <!-- cart[]: cart_close -->
    </div>
    </form>
 
    <div class="container" style="width: 64%; float: right; display: none;" id="showMail">
    
        <div class="topLeft">
    <div class="topRight"><!-- --></div>
</div>
<div class="leftLine">
    <div class="rightLine"> <!-- cart[]: cart_open -->
            <div class="header"> <!-- cart[]: header_open -->
            <div id="showMailId" style="display:none;"></div>
            <div style="margin-left: 2%;">
                <div class="space3Top">Mensaje de:&nbsp;<strong><a id="showMailSender" target="glowna"></a></strong>&nbsp;&nbsp;&nbsp;Para:&nbsp;<strong><a id="showMailReceiver" target="glowna"></a></strong></div>
                <div class="space3Top">Fecha de envío: <strong class="textColor5" id="showMailDate"></strong></div>
                <div class="space3Top">Asunto: <strong class="textColor5" id="showMailTitle"></strong></div>
            </div>
            </div> <!-- cart[]: header_close -->
            <div class="insideContainer space2Top">
    <div class="insideTopLeft">
        <div class="insideTopRight"></div>
    </div>
    <div class="content" style=""> <!-- cart[]: content_open -->
            
                <div id="showMailText"></div>
                <div class="separatorLine space1Top"><!-- --></div>
                <div id="showMailButtons" class="space1Top">
                                        <button type="button" name="" value="" style="cursor: pointer; float:left;"   onClick="setDisplay('replyForm','block');document.replyForm.send_to.focus();">
        <div class="buttonForm">
            <span>
                <span style="white-space: nowrap;" class="textColor3">
                    Responder
                </span>
            </span>
        </div>
    </button>
                                    <a href="#show=inbox" class="button" style="margin-top: 1px;float: left;"  onClick="deleteMail()" id="">
        <span>
            <span style="white-space: nowrap;">
                Borrar
            </span>
        </span>
    </a>
                </div>
                </div>
</div> <!-- cart[]: content_close -->
            </div>
</div>
<div class="bottomLeft">
    <div class="bottomRight"><!-- --></div>
</div> <!-- cart[]: cart_close -->
    </div>
 
    <div id="messagesListContainer" class="container" style="width: 64%; float: right;">
        <div class="topLeft">
    <div class="topRight"><!-- --></div>
</div>
<div class="leftLine">
    <div class="rightLine"> <!-- cart[]: cart_open -->
        <div class="header"> <!-- cart[]: header_open -->
            <div id="messagesListHeader"></div>
        </div> <!-- cart[]: header_close -->
        <div class="insideContainer space2Top">
    <div class="insideTopLeft">
        <div class="insideTopRight"></div>
    </div>
    <div class="content" style=""> <!-- cart[]: content_open -->
              <div id="limitError" style="display:none" class="textColor2 fontSize2 textStyle2 textAlign2">&middot;Your daily sending limit has been reached</div>
            <div class="titleBlock2" style="text-align:center;display:none;" id="pageRewind">
                <a class="textColor4" href="" id="pageRewindPrev">&laquo;</a> <span id="pageRewindNumber"></span> <a class="textColor4" href="" id="pageRewindNext">&raquo;</a>
            </div>
            <div style="width: 100%;">
              <div id="showMessagesList"></div>
            </div>
            <div class="titleBlock2" style="text-align:center;display:none;" id="pageRewindCopy"></div>
 
            </div>
</div> <!-- cart[]: content_close -->
            </div>
</div>
<div class="bottomLeft">
    <div class="bottomRight"><!-- --></div>
</div> <!-- cart[]: cart_close -->
    </div>
 
</div>
<!-- end of mainContainer -->
<div style="width:100%;clear:both;" id="testLog"></div>  <div id="extraLayer1" style="display:none;">
    <a onClick="toggleDivDisplay('extraLayer1');">X</a>
    <div id="extraLayer1Content"></div>
  </div>
  <div id="extraLayer2" style="display:none;"><div>
 
</body>
</html>

This is the part where the button is: (Enviar means Send)

I think it is calling a function.

<a href="#show=sent" class="button" style="margin-top: 1px;float:left;"  onClick="sendMessage();" id="replyFormSendButton">
        <span>
            <span style="white-space: nowrap;">
                Enviar
            </span>
        </span>
    </a>

Hope you can help, thanks in advance.

Link to comment
Share on other sites

Have you looked at the _IE* functions in the help file?

_IELinkClickByText($oIE, "Enviar")
Also the "id" property is mostly equivalent to "name", so you might also get it by:
$oLink = _IEGetObjById($oIE, "replyFormSendButton")
_IEAction($oLink, "click")

See help file.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...