Solved

Php print out ip address make ip address flash or blink

Posted on 2013-01-18
6
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

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…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

717 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