Solved

Php print out ip address make ip address flash or blink

Posted on 2013-01-18
6
335 Views
Last Modified: 2013-01-19
Hi  i have a php script that prints out you users ip address but i am trying to make it flash/blink

php ip address
<?php print $ipadress = $_SERVER['REMOTE_ADDR']; ?>

Open in new window


script that makes text flash but i cant get it to flash the ip address out
<html>
<head>
<title>Blinking sample</title>
<script type="text/javascript">
<!--
function blink() {
  if (!document.all) { return; }
  for (i = 0; i < document.all.length; i++) {
    obj = document.all(i);
    if (obj.className == "blink") {
      if (obj.style.visibility == "visible") {
        obj.style.visibility = "hidden";
      } else {
        obj.style.visibility = "visible";
      }
    }
  }
  setTimeout("blink()", 800);
}
// -->
</script>
</head>
<body onload="blink()">
<h1 class="blink">Blinking sample</h1>
<p>This is normal text</p>
<p class="blink">This is blinking text</p>
<?php print $ipadress = $_SERVER['REMOTE_ADDR']; ?>
</body>
</html>

Open in new window



Thanks for any help given
0
Comment
Question by:paddy086
6 Comments
 
LVL 37

Expert Comment

by:CyanBlue
ID: 38793566
Do this maybe?

CyanBlue
<p class="blink">This is blinking text</p>
<p class="blink"><?php print $ipadress = $_SERVER['REMOTE_ADDR']; ?></p>

Open in new window

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 38793613
Uhm .... obj = document.all(i); Are you kidding?

document.all has been obsolete for 10 years.

just create two classes:

.hilite {visibility: visible;}
.off {visibility:visible;}

The way you appear to be attempting this is just about the least efficient way possible.

target specific ids with document.getElementById();

Cd&
0
 

Author Comment

by:paddy086
ID: 38794769
Hay CyanBlue    I have tried that way but it doesn’t work thanks do.

COBOLdinosaur  Have not got a clue what you mean I just Google java script to make text flash I was winging it by just putting my php print out into the location the text was meant to go
Could you show me what to do in a script please

Thanks
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 200 total points
ID: 38795288
You don't learn much if I just write the whole script for you. So I will give you the description and you do the coding.  Just cutting an pasting stuff from Google is not development, and even using that method you need to learn enough coding to be able to implement what you find.

So, you create those two classes in the stylesheet, there was a typo in what I posted. it should be:
.hilite {visibility: visible;}
.off {visibility:hidden;}

 and then in your script instead of changing visibility, you target the specific elements that need to blink based on their id and change the class:

document.getElementById('whateverid').className='hilite';
or
document.getElementById('whateverid').className='off';

Cd&
0
 
LVL 9

Accepted Solution

by:
rinfo earned 300 total points
ID: 38796153
you can use text-decoration :blinking but its not supported in IE, Safari,chrome
try javascript that i have copied and tested from
http://istockphp.com/jquery/blinking-text-using-jquery/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blinking Text | istockphp.com</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
	var x;
		setInterval(function() {
				if(x == 0) {
					$('.blinking').removeAttr('style');
					x = 1;
				} else  {
					if(x = 1) {
						$('.blinking').css('color', 'red');
						x = 0;
					}
				}
		}, 500);
});
</script>

</head>

<body>
	<p class="blinking">istockphp.com</p>
</body>
</html>

Open in new window

0
 

Author Comment

by:paddy086
ID: 38797601
Thanks COBOLdinosaur for your help i gave it a shot did not work out for me.

rinfo your java script worked for what i was trying to achieve thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now