Solved

Php print out ip address make ip address flash or blink

Posted on 2013-01-18
6
341 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 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