Click to See Complete Forum and Search --> : java script


superhl
06-04-2003, 04:38 PM
"I have a intranet that I would love to get this news stroller to work , however, I know nothing about java , a little knowledge on front page, and very little html. Please help.. the text in quotes are problems I an experiencing. Thanks for any help!!!!"

<!-- THREE STEPS TO INSTALL NEWS SCROLLER:

1. Copy the coding into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Put the last coding into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Dion (yobo42@hotmail.com) -->
<!-- Web Site: http://www.iinet.net.au/~biab/ -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

// change this to where you store the blank.gif image
var blank = "http://www.your-web-site-address-here.com/blank.gif"; "I have any intranet site on my local server with a NAT address. Located under Apps/instranet… how do I point this to that directory. For testing purpose, suppose I store the blank gif under the c:\ under my workstation…. Would I “c:\blank.gif”
Also How do I create a blank gif? ??? Create a word doc and rename as gif???"

topedge = 130; // location of news box from top of page
leftedge = 10; // location of news box from left edge
boxheight = 150; // height of news box
boxwidth = 210; // width of news box
scrollheight = 240; // total height of all data to be scrolled

function scrollnews(cliptop) {
if (document.layers) {
newsDiv = document.news;
newsDiv.clip.top = cliptop;
newsDiv.clip.bottom = cliptop + boxheight;
newsDiv.clip.left = 0;
newsDiv.clip.right = boxwidth + leftedge;
newsDiv.left = leftedge;
newsDiv.top = topedge - cliptop;
}
else {
newsDiv = news.style;
newsDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
newsDiv.pixelLeft = leftedge;
newsDiv.pixelTop = topedge - cliptop;
}
cliptop = (cliptop + 1) % (scrollheight + boxheight);
newsDiv.visibility='visible';
setTimeout("scrollnews(" + cliptop + ")", 150);
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag --> "Where exactly do I place this text."

<BODY OnLoad="scrollnews(0)">

<!-- STEP THREE: Copy this code into the BODY of your HTML document -->

<div ID="news" style="position:absolute; visibility:hidden;
top:1; left:1; height:600;
clip:rect(10,100,100,10); border-width:0px;">
<table border=0 cellpadding=1 cellspacing=0 bgcolor="white">
<tr>
<td>
<script language="javascript">
document.write('<img src=' + blank + ' width=1 height='+boxheight+'>');
</script>
</td>
</tr>
<tr>
<td>

<!-- Your News Items are Here -->

This news scroller begins<br>
Displaying text and images<br>
From the bottom of the box<br>
And restarts when all the<br>
Information scrolls above<br>
The top of the box.<br><br>
Any HTML page content can<br>
Be used in this Javascript<br>
Scroller.<br>
<br>
<a href="mailto:yobo42@hotmail.com">yobo42@hotmail.com</a>

<!-- End Of Your News Items -->

</td>
</tr>
<tr>
<td>
<script language="javascript">
document.write('<img src=' + blank + ' width=1 height='+boxheight+'>');
</script>
</td>
</tr>
</table>
</div>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 2.71 KB -->

David Harrison
06-04-2003, 04:45 PM
By blank.gif if means an image or animation with a .gif extension, like .jpg or .mp3, If you were to have an image called "hello.jpg" in the folder "hi there" on the c:\ the address of that picture would be "c:\hi there\hello.jpg".

On a web-page this is the basic layout

<html>

<head>

<title>Page Name</title>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original...

... ")", 150);
}
// End -->
</script>

</head>

<body OnLoad="scrollnews(0)">

Page content in this case what it tells you in your script.

</body>

</html>

havik
06-04-2003, 07:18 PM
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag --> "Where exactly do I place this text."

Anything between <!-- and --> are comments. This text is not necessary for the functioning of the code. However, if you are refering to the code below it:
<body onload="scrollnews(0)">
Then this is your new body tag.

Havik

superhl
06-05-2003, 09:53 AM
This is how I imput the script, but I am not getting in action. thanks
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Home Page</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Border" content="tl, default">
<meta name="Microsoft Theme" content="none, default">
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Dion (yobo42@hotmail.com) -->
<!-- Web Site: http://www.iinet.net.au/~biab/ -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

// change this to where you store the blank.gif image
var blank = "c:\2000.gif";

topedge = 130; // location of news box from top of page
leftedge = 10; // location of news box from left edge
boxheight = 150; // height of news box
boxwidth = 210; // width of news box
scrollheight = 240; // total height of all data to be scrolled

function scrollnews(cliptop) {
if (document.layers) {
newsDiv = document.news;
newsDiv.clip.top = cliptop;
newsDiv.clip.bottom = cliptop + boxheight;
newsDiv.clip.left = 0;
newsDiv.clip.right = boxwidth + leftedge;
newsDiv.left = leftedge;
newsDiv.top = topedge - cliptop;
}
else {
newsDiv = news.style;
newsDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
newsDiv.pixelLeft = leftedge;
newsDiv.pixelTop = topedge - cliptop;
}
cliptop = (cliptop + 1) % (scrollheight + boxheight);
newsDiv.visibility='visible';
setTimeout("scrollnews(" + cliptop + ")", 150);
}
// End -->
</script>
</head>

<body><div ID="news" style="position:absolute; visibility:hidden;
top:1; left:1; height:600;
clip:rect(10,100,100,10); border-width:0px;">
<table border=0 cellpadding=1 cellspacing=0 bgcolor="white">
<tr>
<td>
<script language="javascript">
document.write('<img src=' + blank + ' width=1 height='+boxheight+'>');
</script>
</td>
</tr>
<tr>
<td>

<!-- Your News Items are Here -->

This news scroller begins<br>
Displaying text and images<br>
From the bottom of the box<br>
And restarts when all the<br>
Information scrolls above<br>
The top of the box.<br><br>
Any HTML page content can<br>
Be used in this Javascript<br>
Scroller.<br>
<br>
<a href="mailto:yobo42@hotmail.com">yobo42@hotmail.com</a>

<!-- End Of Your News Items -->

</td>
</tr>
<tr>
<td>
<script language="javascript">
document.write('<img src=' + blank + ' width=1 height='+boxheight+'>');
</script>
</td>
</tr>
</table>
</div>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 2.71 KB -->
</body>

</html>

Khalid Ali
06-05-2003, 10:02 AM
The second point in the code is to add an event handler in the body tag..which you don't have ...

change your body tag from this

<body>

to
<body onload="scrollnews(0)">


assuming everything else is correct.

superhl
06-05-2003, 11:32 AM
thanks for your help, the default scroller works, however, not sure about the blank.gif. I created a html on my c:\drive but I am not retieving any info. again, thanks