Script gia status bar?

Κώδικας, πληροφορίες, ερωτήσεις και απαντήσεις σχετικές με την JavaScript.

Συντονιστές: WebDev Moderators, Super-Moderators

Απάντηση
Άβαταρ μέλους
GRaecuS
Δημοσιεύσεις: 113
Εγγραφή: 02 Απρ 2003 10:21
Τοποθεσία: Thessaloniki
Επικοινωνία:

Script gia status bar?

Δημοσίευση από GRaecuS » 16 Μάιος 2003 08:17

:idea: Mhpws 3erei kaneis kana scriptaki gia kinoumeno text sth status bar? :hammer:

Άβαταρ μέλους
Mahadeva
Δημοσιεύσεις: 242
Εγγραφή: 15 Μάιος 2003 13:52
Τοποθεσία: Astral Plane
Επικοινωνία:

Script gia status bar?

Δημοσίευση από Mahadeva » 16 Μάιος 2003 10:34

<html>
<head>
<TITLE>Simple pull-scroller</TITLE>

<meta NAME="keywords" CONTENT="message, scroller, JavaScript, DHTML, download, free, ticker, status,bar">

<meta NAME="description" CONTENT="Very simple status-bar-scroller that pulls your messages together. Crossbrowser. Add as many messages as you like.">

<script language=javaScript>
<!-- Beginning of JavaScript -

// CREDITS:
// Simple pull-scroller by Urs Dudli and Peter Gehrig
// Copyright (c) 2000 Peter Gehrig and Urs Dudli. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.24fun.com.
// info@24fun.ch
// 10/4/2000

// IMPORTANT:
// If you add this script to a script-library or a script-archive
// you have to insert a link to http://www.24fun.com right into the webpage where the script
// will be displayed.

// CONFIGURATION:
// 1. Delete the DIV-block with the id "deletethisblock". You don't need it.
// 2. Configure messages and scroller-speed inside the head-section of the script.


// Configure your messages. You may add as many messages as you like.
var message = new Array()
message[0]="Hi Web Builder."
message[1]="Do not stare at the screen."
message[2]="Go out and enjoy life instead!"

// Configure the speed of the message. A lower value means higher speed.
var pause=20

// Configure the standstill-time between the messages (milliseconds).
var standstill=2000

// Configure the maximum space between the letters.
var max_space=30

// Do not edit the variables below
var space=" "
var i_substring=0
var i_message=0
var i_space=max_space
var all_space=" "
var content=""

function reducespace() {
all_space=" "
for (i=0;i<i_space;i++) {
all_space+=" "
}
for (i=0;i<message[i_message].length-1;i++) {
var thisletter=message[i_message].substring(i,i+1)
thisletter=thisletter+all_space
content+=thisletter
}
showmessage()
}

function showmessage() {
window.status=content
i_space--
if (i_space>=0) {
content=""
var timer=setTimeout("reducespace()", pause)
}
else {
clearTimeout(timer)
i_space=max_space
var timer=setTimeout("changemessage()", standstill)
}
}

function changemessage() {
i_message++
if (i_message>message.length-1) {
i_message=0
}
reducespace()
}

// - End of JavaScript - -->
</script>

</head>

Άβαταρ μέλους
GRaecuS
Δημοσιεύσεις: 113
Εγγραφή: 02 Απρ 2003 10:21
Τοποθεσία: Thessaloniki
Επικοινωνία:

Script gia status bar?

Δημοσίευση από GRaecuS » 20 Μάιος 2003 11:50

Το δοκίμασα αλλα δεν μπορώ να το λειτουργήσω....
Δεν ξερω καν αν είναι αυτό που ζήτησα.
Δες την status bar του http://aetos.it.teithe.gr/~athoik/welcome.html για να καταλάβεις.
Πάντως ευχαριστώ...

Άβαταρ μέλους
Nidas
Honorary Member
Δημοσιεύσεις: 2348
Εγγραφή: 03 Απρ 2003 13:09
Τοποθεσία: Germany/Wuppertal-Hellas/Preveza

Script gia status bar?

Δημοσίευση από Nidas » 20 Μάιος 2003 13:29

*GRaecuS* gia des afto
antegrapseto kato apo to <body>


<SCRIPT LANGUAGE="JavaScript">
<!--// Copyright 1996 - Tomer and Yehuda Shiran
// This example will appear in our forthcoming book on JavaScript.
// Feel free to "steal" this code provided that you leave this notice as is.
// Additional examples from the book can be found at http://www.geocities.com/SiliconValley/9000/
// For more information contact Tomer or Yehuda Shiran <yshiran@iil.intel.com>

// set speed of banner (pause in milliseconds between addition of new character)
var speed = 10

// decrease value to increase speed (must be positive)
// set pause between completion of message and beginning of following message
var pause = 1500

// increase value to increase pause
// set initial values
var timerID = null
var bannerRunning = false

// create array
var ar = new Array()

// assign the strings to the array's elements
ar[0] = "Kalosirthate"
ar[1] = "Sto"
ar[2] = "Free"
ar[3] = "Stuff!"

// assign index of current message
var message = 0

// empty string initialization
var state = ""

// no value is currently being displayed
clearState()

// stop the banner if it is currently running
function stopBanner() {
// if banner is currently running
if (bannerRunning)
// stop the banner
clearTimeout(timerID)
// timer is now stopped
timerRunning = false
}

// start the banner
function startBanner() {
// make sure the banner is stopped
stopBanner()
// start the banner from the current position
showBanner()
}

// assign state a string of "0" characters of the length of the current message
function clearState() {
// initialize to empty string
state = ""
// create string of same length containing 0 digits
for (var i = 0; i < ar[message].length; ++i) {
state += "0"
}
}

// display the current message
function showBanner() {
// if the current message is done
if (getString()) {
// increment message
message++
// if new message is out of range wrap around to first message
if (ar.length <= message)
message = 0
// new message is first displayed as empty string
clearState()
// display next character after pause milliseconds
timerID = setTimeout("showBanner()", pause)
}
else {
// initialize to empty string
var str = ""
// built string to be displayed (only character selected thus far are displayed)
for (var j = 0; j < state.length; ++j) {
str += (state.charAt(j) == "1") ? ar[message].charAt(j) : " "
}
// partial string is placed in status bar
window.status = str
// add another character after speed milliseconds
timerID = setTimeout("showBanner()", speed)
}
}

function getString() {
// set variable to true (it will stay true unless proven otherwise)
var full = true
// set variable to false if a free space is found in string (a not-displayed char)
for (var j = 0; j < state.length; ++j) {
// if character at index j of current message has not been placed in displayed string
if (state.charAt(j) == 0)
full = false
}
// return true immediately if no space found (avoid infinitive loop later)
if (full) return true
// search for random until free space found (braoken up via break statement)
while (1) {
// a random number (between 0 and state.length - 1 == message.length - 1)
var num = getRandom(ar[message].length)
// if free space found break infinitive loop
if (state.charAt(num) == "0")
break
}
// replace the 0 character with 1 character at place found
state = state.substring(0, num) + "1" + state.substring(num + 1, state.length)
// return false because the string was not full (free space was found)
return false
}

function getRandom(max) {
// create instance of current date
var now = new Date()
// create a random number (good generator)
var num = now.getTime() * now.getSeconds() * Math.random()
// cut random number to value between 0 and max - 1, inclusive
return num % max
}
startBanner()
// -->
</SCRIPT>







ena paromia san afto pou epsaxnes
alaxe mono to keimeno me ta ble gramata!
pisteuo pos se boithisa arketa! :hammer: :hammer: :hammer:

Άβαταρ μέλους
GRaecuS
Δημοσιεύσεις: 113
Εγγραφή: 02 Απρ 2003 10:21
Τοποθεσία: Thessaloniki
Επικοινωνία:

Script gia status bar?

Δημοσίευση από GRaecuS » 26 Μάιος 2003 22:50

To δοκίμασα και είναι αρκετά καλό.
Αλλά μήπως ξέρεις κάτι σε στυλ marquee?

Άβαταρ μέλους
Nidas
Honorary Member
Δημοσιεύσεις: 2348
Εγγραφή: 03 Απρ 2003 13:09
Τοποθεσία: Germany/Wuppertal-Hellas/Preveza

Script gia status bar?

Δημοσίευση από Nidas » 26 Μάιος 2003 23:26

Mallon psaxneis afto!



<BODY onLoad="scrollit(100)">
<SCRIPT>
<!--
function scrollit(seed) {
var m1 = "Kalosirthate !";
var m2 = " sto ";
var m3 = " freestuff.gr!";
var m4 = "";
var msg=m1+m2+m3+m4;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
cmd="scrollit("+seed+")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
window.status=out;
cmd="scrollit("+seed+")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
window.status=out;
cmd="scrollit("+seed+")";
timerTwo=window.setTimeout(cmd,100);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scrollit(100)",75);
}
}
}
//-->
</SCRIPT>




opou kokkino to keimeno sou!
kai afton ton kodiko antegrapseton kato apo to body!
Tora pisteuo pos eisai ok i oxi?

Άβαταρ μέλους
GRaecuS
Δημοσιεύσεις: 113
Εγγραφή: 02 Απρ 2003 10:21
Τοποθεσία: Thessaloniki
Επικοινωνία:

Script gia status bar?

Δημοσίευση από GRaecuS » 05 Ιουν 2003 23:00

Bingo!!! Είναι τέλειο... Thanks! ;)

Άβαταρ μέλους
Nidas
Honorary Member
Δημοσιεύσεις: 2348
Εγγραφή: 03 Απρ 2003 13:09
Τοποθεσία: Germany/Wuppertal-Hellas/Preveza

Script gia status bar?

Δημοσίευση από Nidas » 06 Ιουν 2003 23:08

Tipota! :wink:

Άβαταρ μέλους
vourexx
Δημοσιεύσεις: 203
Εγγραφή: 03 Απρ 2002 03:00
Τοποθεσία: greece
Επικοινωνία:

Script gia status bar?

Δημοσίευση από vourexx » 26 Ιουν 2003 14:53

gia dokimase kai ayto tha sou aresei




<SCRIPT>
<!-- Hide from old browsers


message = " κείμενο 1 ^" +
" κείμενο 2 ^" +
" κείμενο 3 ^" +
"^"
scrollSpeed = 25
lineDelay = 1500

// Do not change the text below //

txt = ""

function scrollText(pos) {
if (message.charAt(pos) != '^') {
txt = txt + message.charAt(pos)
status = txt
pauze = scrollSpeed
}
else {
pauze = lineDelay
txt = ""
if (pos == message.length-1) pos = -1
}
pos++
setTimeout("scrollText('"+pos+"')",pauze)
}

// Unhide -->
scrollText(0)
</SCRIPT>





good luck

Απάντηση

Επιστροφή στο “JavaScript και Frameworks”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 1 επισκέπτης