Results 1 to 2 of 2

Thread: Need some help with javascript

  1. #1
    Join Date
    Mar 2010
    Posts
    1

    Need some help with javascript

    I'm using Java script to print a message to screen I'm trying to find a way for the script to identify the end users browser, ip address and Operating System, I'm hoping some one can help me out.

    the script i am using to print messages out onto the screen is belowe

    Code:
    div align="right">
    </div>
    &nbsp;<div align="center">
      <center>
    <table width="520" height="215" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0" align="left">
    <tr>
    <td width="364">
    <div id="myContent" class="tip">
    </div>
    <div id="contentToWrite" style="display:none; text-decoration: overline; color: ; width:552; height:570"red;" class="tip">
    
    
    
    <br /> Text to be printed out goes here
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br /> 
    <br /> 
    <br />
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br /> 
    <br /> 
    <br /> 
    <br /> 
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br />
    <br>
    <br />
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    <br>
    <br /> 
    </div>
    </td>
    </tr>
    </table>
    </center>
    </div>
    <p style="font-family:arial;color:black; font-size:30px">
    <style>
    
    body { font-family: serif; color: white; }
    </style>
    <style type="text/css">
    <!--
    #Layer1 {
        
    
    }
    -->
    </style>
    
    
    <center>
    <p></p>
    </center>
    
    
    
    <script type="text/javascript">
        var charIndex = -1;
        var stringLength = 0;
        var inputText;
        function writeContent(init){
            if(init){
                inputText = document.getElementById('contentToWrite').innerHTML;
            }
            if(charIndex==-1){
                charIndex = 0;
                stringLength = inputText.length;
            }
            var initString = document.getElementById('myContent').innerHTML;
            initString = initString.replace(/<SPAN.*$/gi,"");
    
            var theChar = inputText.charAt(charIndex);
               var nextFourChars = inputText.substr(charIndex,4);
               if(nextFourChars=='<BR>' || nextFourChars=='<br>'){
                   theChar  = '<BR>';
                   charIndex+=3;
               }
            initString = initString + theChar + "<SPAN id='blink'>_</SPAN>";
            document.getElementById('myContent').innerHTML = initString;
    
            charIndex = charIndex/1 +1;
            if(charIndex%2==1){
                 document.getElementById('blink').style.display='none';
            }else{
                 document.getElementById('blink').style.display='inline';
            }
    
            if(charIndex<=stringLength){
                setTimeout('writeContent(false)',90);
            }else{
                blinkSpan();
            }
        }
    
        var currentStyle = 'inline';
        function blinkSpan(){
            if(currentStyle=='inline'){
                currentStyle='none';
            }else{
                currentStyle='inline';
            }
            document.getElementById('blink').style.display = currentStyle;
            setTimeout('blinkSpan()',300);
    
        }
        
        
    msg = "MSG Goes HERE";
    
    msg = " " + msg;pos = 0;
    function scrollMSG() {
    document.title = msg.substring(pos, msg.length) + msg.substring(0, pos);
    pos++;
    if (pos >  msg.length) pos = 0
    window.setTimeout("scrollMSG()",200);
    }
    scrollMSG();
    </script>
    <center>
    
    
    <table class="listing">
    <tr>
    
    <td class="listing">
    
    </td>
    
    </tr>
    </table>
    <p>&nbsp;  </p>
    <p>
      <script type="text/javascript">
    writeContent(true);
      </script>
    </p>
    </center>
    <script>
    function EvalSound(soundobj) {
      var thissound=document.getElementById(soundobj);
      thissound.Play();
    }
    </script>
    Last edited by purity_2010; 02 Mar 2010 at 05:31 AM. Reason: code tags, i noticed id made a typo

  2. #2
    Join Date
    Feb 2010
    Posts
    45
    Hi,

    Here is the URL to know the Browser & Operating System for the User - http://www.javascriptkit.com/javatutors/navigator.shtml

    For IP Address check the URL - http://javascript.internet.com/user-...p-address.html

    Cheers,

    ~Maneet

Similar Threads

  1. Replies: 0
    Last Post: 29 Jan 2010, 02:25 PM
  2. JavaScript Collector
    By JavaScriptBank in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 09 Jul 2009, 03:28 AM
  3. JavaScript library
    By JavaScriptBank in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 09 Jul 2009, 01:26 AM
  4. element specific javascript
    By gumbo in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 04 Dec 2005, 06:25 PM
  5. element specific javascript
    By gumbo in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 04 Dec 2005, 06:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •