PDA

View Full Version : Need some help with javascript



purity_2010
01 Mar 2010, 07:02 AM
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



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>

Rash
10 Mar 2010, 06:44 AM
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-details/ip-address.html

Cheers,

~Maneet