Solved

Php print out ip address make ip address flash or blink

Posted on 2013-01-18
6
333 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
Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

705 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