/    Sign up×
Community /Pin to ProfileBookmark

What do these scripts do?

I found somewhere these 2 little scripts and wonder what they do:

if ( top.location != this.location ) top.location = this.location;

var jsg_jezik_S = “si”;

function um_slika(s)
{
um_okno(s, 650, 650, null, “eZdravjeSlika”)
}

translation:
jezik = language
slika = image
okno = window

And the other one:
function showhide(ecid)
{
var ec = document.getElementById(ecid);
if (ec.style)
{
if (ec.style.display == ‘none’)
{
ec.style.display = ‘block’;
}
else
{
ec.style.display = ‘none’;
}
}
}

Thanx, Ivo.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@fredmvFeb 28.2004 — [i]Originally posted by ivo [/i]

[B]if ( top.location != this.location ) top.location = this.location;[/B][/QUOTE]
This is your generic "break out of frames script"; it simply checks to see if the loation of the document is the same of the containing document. If the document is indeed contained within a frameset, it redirects the topmst frame (i.e., the frameset containing the pages) to the actual location.[i]Originally posted by ivo [/i]

[B]var jsg_jezik_S = "si";[/B][/QUOTE]
Simply initalizes a variable with the string "si" assigned to it.[i]Originally posted by ivo [/i]

[B]function um_slika(s)

{

um_okno(s, 650, 650, null, "eZdravjeSlika")

}[/B]
[/QUOTE]
Would be just about impossible to explain this one due to the fact that we do not have access to the [font=courier]um_okno[/font] function.[i]Originally posted by ivo [/i]

[B]function showhide(ecid)

{

var ec = document.getElementById(ecid);

if (ec.style)

{

if (ec.style.display == 'none')

{

ec.style.display = 'block';

}

else

{

ec.style.display = 'none';

}

}

}[/B]
[/QUOTE]
This is your generic "show hide element" script (i.e., it accepts the [font=courier]id[/font] of the element and will toggle whether you can see it or not) which, mind you, could be written much more efficently...
Copy linkTweet thisAlerts:
@ivoauthorFeb 28.2004 — Thanx, no further questions... for now ?))
×

Success!

Help @ivo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...