# Shkenca > Informatikë dhe Internet > Arti i programimit >  JavaScript - Skripte të gatshëm

## strongman

Hapa ketë teme ku do t'i postojme ndonjë kod te mirë për Web Design.
Ju qe dini ju lutemi postoni ketu, sepse une  nuk ka njohuri.

----------


## besart

Strongman une po e shkruaj një shumë te thjeshtë sa për fillim:

Kthimi në faqen e mëparshme,i njëjti funksion me pullen "Back" që gjindet ne shiritin e IE.

Kodi:

<a href="javascript**:history.go(-1)">Prapa</a>

----------


## besart

```

<script language="JavaScript">

var message="Na vjen keq, por ky funksion është i pamundur."; 

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;


</script> 



```

----------


## strongman

Po ku jeni ju qe dini javascript, shkrani ndonjë kod të mirë!
Besart ky kodi i dyte te koka shume i mirë.

----------


## 1-shi

Ndryshe kthimi prapa mund te shkruhet:

javascript**:history.back(1)

----------


## reni00

kodi i nje ore multi display



```
<!-- Tre gjera per ty bere:

  1. kopjo kodin ne HEAD te HTML-s tende
  2.  shto onLoad ne  BODY tag
  3.  Vendos kete kod ne brenda html-se  -->

<!-- HEAD-->

<HEAD>

<style type="text/css">
<!--
input {
  border: 0;
  background-color: #fff;
	color: #000;
}
-->
</style>

<script type="text/javascript">
<!--
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Ryan Provost :: http://rynprov.100free.com */

function clock() {
  if (!document.layers && !document.all) return;
  var hex = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
  var ticktock = new Date();
  var month = ticktock.getMonth()+1;
  var date = ticktock.getDate();
  var day = ticktock.getDay();
  var year = ticktock.getFullYear();
  var utime = ticktock.getTime();
  var hours = ticktock.getHours();
  var minutes = ticktock.getMinutes();
  var seconds = ticktock.getSeconds();

  var GMTmonth = ticktock.getUTCMonth()+1;
  var GMTdate = ticktock.getUTCDate();
  var GMTday = ticktock.getUTCDay();
  var GMTyear = ticktock.getUTCFullYear();
  var GMThours = ticktock.getUTCHours();
  var GMTminutes = ticktock.getUTCMinutes();
  var GMTseconds = ticktock.getUTCSeconds();

  var milliseconds = (utime*1000).toString().substring(10,13);
  var apm = "am";

  var Swatch = "@" + (((utime/86400000)%1)+(1/24)).toString().substring(2,5);

  var decimaltime = ((hours/24)+(minutes/1440)+(seconds/86400)+(milliseconds/86400000));
  decimaltime = decimaltime.toString().substring(1,7);
  var udect = ((utime/86400000)%1).toString().substring(1,7);
  var totalseconds = (hours * 3600 + minutes * 60 + seconds + milliseconds / 1000);
  var gotime = utime/864 + 50000;
  var umt1 = gotime.toString().substring(5,7);
  var umt2 = gotime.toString().substring(7,10);

  with (Math) {
    var hextime = floor(totalseconds / 1.318359375);
    var hex1 = floor(hextime / 4096);
    hextime -= 4096 * hex1;
    var hex2 = floor(hextime / 256);
    hextime -= 256 * hex2;
    var hex3 = floor(hextime / 16);
    hextime -= 16 * hex3;
    var hex4 = hextime;
  }

  var hexadecimalValue = hex[hex1] + "_"+ hex[hex2] + hex[hex3] + "_" + hex[hex4];

  if (day==0)
    day="Sun";
  if (day==1)
    day="Mon";
  if (day==2)
    day="Tue";
  if (day==3)
    day="Wed";
  if (day==4)
    day="Thu";
  if (day==5)
    day="Fri";
  if (day==6)
    day="Sat";

  if (GMTday==0)
    GMTday="Sun";
  if (GMTday==1)
    GMTday="Mon";
  if (GMTday==2)
    GMTday="Tue";
  if (GMTday==3)
    GMTday="Wed";
  if (GMTday==4)
    GMTday="Thu";
  if (GMTday==5)
    GMTday="Fri";
  if (GMTday==6)
    GMTday="Sat";

  if (month <= 9) month = "0" + month;
  if (date <= 9) date = "0" + date;
  if (hours > 11) apm = "pm";
  if (hours > 12) hours = hours - 12;
  if (hours == 0) hours = 12;
  if (hours <= 9) hours = "0" + hours;
  if (minutes <= 9) minutes = "0" + minutes;
  if (seconds <= 9) seconds = "0" + seconds;

  if (GMTmonth <= 9) GMTmonth = "0" + GMTmonth;
  if (GMTdate <= 9) GMTdate = "0" + GMTdate;
  if (GMThours <= 9) GMThours = "0" + GMThours;
  if (GMTminutes <= 9) GMTminutes = "0" + GMTminutes;
  if (GMTseconds <= 9) GMTseconds = "0" + GMTseconds;

  var NETbase = utime/86400000*360;
  var NETdegrees = Math.floor(NETbase%360);
  var NETminutes = Math.floor((NETbase*60)%60);
  if (NETminutes <= 9) NETminutes = "0" + NETminutes;
  var NETstring = NETdegrees + "°" + NETminutes + "' NET";

  var localValue = "Local Date/Time: " + year + "." + month + "." + date + " " + day + " " + hours + ":" + minutes + ":" + seconds + "." + milliseconds + " " + apm;
  var GMTValue = "GMT/UTC Date/Time: " + GMTyear + "." + GMTmonth + "." + GMTdate + " " + GMTday + " " + GMThours + ":" + GMTminutes + ":" + GMTseconds + "." + milliseconds;
  var dtimeValue = "Local Decimal Time: " + decimaltime;
  var udtimeValue = "Decimal Time GMT: " + udect; // decimaltime.hynes.net
  var umtValue = "Universal Metric Time: " + umt1 + "." + umt2; // More at Zapatopi.net
  var hexValue = "Hexadecimal Time: " + hexadecimalValue; // More at intuitor.com/hex
  var unixValue = "Milliseconds since 1/1/1970 00:00 GMT: " + utime;
  var SwatchValue = "Swatch Internet Time: " + Swatch + " .beats"; // More at Swatch.com
  var NETValue = "New Earth Time: " + NETstring; // More at Newearthtime.net

  document.clock.localface.value = localValue;
  document.clock.GMTface.value = GMTValue;
  document.clock.dtimeface.value = dtimeValue;
  document.clock.udtimeface.value = udtimeValue;
  document.clock.umtface.value = umtValue;
  document.clock.hexface.value = hexValue;
  document.clock.unixface.value = unixValue;
  document.clock.Swatchface.value = SwatchValue;
  document.clock.NETface.value = NETValue;

  //Countdown
  var cyear = 2008;  //  enter 4-digit year
  var cmonth = 0;    //  0 for January, 1 for February ... 11 for December
  var cdate = 1;   //  day of the month
  var chours = 0;    //  24-hour only
  var cminutes = 0;
  var cseconds = 0;
  var cms = 0;   //  milliseconds

  var description = "New Year's 2008";
  var future = new Date(cyear,cmonth,cdate,chours,cminutes,cseconds,cms);
  var future2 = future.getTime();
  countdown = future - utime;
  countsec = Math.floor(countdown/1000);
  countdays = Math.floor(countdown/86400000*1000)/1000;
  var csValue = "Seconds until " + description + ": " + countsec;
  var cdValue = "Days until " + description + ": " + countdays;
  document.clock.csface.value = csValue
  document.clock.cdface.value = cdValue

  setTimeout("clock()", 1);
}
-->
</script>

</HEAD>

<!-- STEP TWO: BODY tag  -->

<BODY onLoad="clock()">

<!-- STEP THREE:BODY of your HTML document  -->

<div align="center">
<form name="clock" enctype="text/plain" onsubmit="0">
<input type="text" name="localface" size="52" value="Loading" readonly><br>
<input type="text" name="GMTface" size="52" value="Loading" readonly><br>
<input type="text" name="dtimeface" size="52" value="Loading" readonly><br>
<input type="text" name="udtimeface" size="52" value="Loading" readonly><br>
<input type="text" name="umtface" size="52" value="Loading" readonly><br>
<input type="text" name="hexface" size="52" value="Loading" readonly><br>
<input type="text" name="unixface" size="52" value="Loading" readonly><br>
<input type="text" name="Swatchface" size="52" value="Loading" readonly><br>
<input type="text" name="NETface" size="52" value="Loading" readonly><br>
<input type="text" name="csface" size="52" value="Loading" readonly><br>
<input type="text" name="cdface" size="52" value="Loading" readonly>
</form>
</div>
```

----------


## strongman

Me duhet nje kod qe ben detektimin e Flashit ne PC, nese pc nuk ka flash faqen ta ridrejtoj ne nje faqe tjeter html e cila nuk ka flash.

----------


## besart

```
<script language=JavaScript>
<!--
var VersioniPermbajtjes = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var fjalet = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < fjalet.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var PluginVersioni = fjalet[i]; 
	    }
	var FlashiMundet = PluginVersioni >= VersioniPermbajtjes;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('FlashiMundet = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & VersioniPermbajtjes)))\n');
	document.write('</SCR' + 'IPT\> \n');
}
if ( FlashiMundet ) {
	window.location.replace("http:/www.sajtijuaj.com/meflash.htm");
} else{
	window.location.replace("http:/www.sajtijuaj.com/paflash.htm");
}
//-->

</script>
```

Kete e vendos ne nje faqe tjeter psh:
http:/www.sajtijuaj.com/index.htm, vetem ki kujdes duhet ta kopjosh brenda tagut *head*.
Nese kompjuteri i personit qe viziton sajtin tuaj perkrah flash plugin, at&#235;her&#235; ai ridrejtohet ne faqen: http:/www.sajtijuaj.com/meflash.htm; mir&#235;po n&#235;se nuk  perkrah flash plugin, ridrejtohet n&#235; faqen http:/www.sajtijuaj.com/paflash.htm

----------


## besart

Nëse deshiron qe kodin ta vendosesh direkt ne faqen psh: index.htm, atëherë kodin perfundi e kopjon dhe e vendosë brenda tagut *head*



```
<script language=JavaScript>
<!--
var VersioniPermbajtjes = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var fjalet = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < fjalet.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var PluginVersioni = fjalet[i]; 
	    }
	var FlashiMundet = PluginVersioni >= VersioniPermbajtjes;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('FlashiMundet = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & VersioniPermbajtjes)))\n');
	document.write('</SCR' + 'IPT\> \n');
}
if ( FlashiMundet ) {
	window.location.this};
} else{
	window.location.replace("http:/www.sajtijuaj.com/paflash.htm");
}
//-->
</script>
```

Kjo funksionon kështu:

Kur vizitori i sajtit tuaj hapen faqen psh: http:/www.sajtijuaj.com/index.htm; nëse kompjuteri i tij përkarh flash plugin, ai mbetet tek faqja në fjalë, mirëpo nësi nuk përkrah flash plugin ai ridrejtohet në faqen ku nuk ka flash, në rastin tonë: http:/www.sajtijuaj.com/paflash.htm


Nëse ke probleme na trego, do mundohemi te te ndihmojmë.

----------


## Ardi_Pg_ID

Do ishte mire ta shpjegoje cdopjese specifike tescriptin se cfre ben. Po nese versioni i flash eshte 7 apo se fundi 8 ?
Pune te shkelqyer

Ardi

----------


## ylber1998

Nj&#235; kod pasi ke krijuar si ata m&#235; lart psh,dhe don t&#235; shikosh se qka ke krijuar,at&#235;her a duhet ti vendosum ne Notepad,dhe a duhet dh&#235;n psh si ne HTML,All files dhe emrin e dokumentit psh ylberi.html,per te dalur ne Browser puna jote,a duhet b&#235;r k&#235;shtu edhe m&#235; kodet m&#235; lart...kodet e Java scriptit

----------


## besart

Po kopjoje kodin dhe vendose ne notepad, është mirë edhe pse jo e domosdoshme ne te gjitha rastet qe kodi te vendoset brenda tagut head, (disa skripta funksionojne edhe ashtu siq jane shkruar, varet nga funksioni i tyre).
Keshtu hape notepadin dhe shkruaj:



```
<html>
<head>
<title>Skripta</title>
Skripta vjen ketu
</head>
<body>
</body>
</html>
```

----------


## ylber1998

P&#235;r n&#235; HTML e di mirpo thash ne Programim psh ai kodi yt m&#235; lart...at kod si duhet tja b&#235;r p&#235;r t&#235; shikua a duhet qitur edhe at&#235; n&#235; Notepad,me ja b&#235;r All Files,tani emni i dokumentin psh besarti.html, apo qysh duhet b&#235;r kodit p&#235;r t&#235; par qfare kemi krijuar e kam flajen p&#235;r Programim e jo ne html

----------


## besart

ylber,  eshte po ajo qe po thua, vendose ne notepad dhe ruaje me prapashtes&#235; .htm ose .html

----------


## strongman

Besart shume faleminderit, ishte mu kjo qe po kerkoja prej koh&#235;sh, dhe ishte i vetmi forumishqiptar qe me dhe nje pergjigje e cila me duhej.
Edhe njehere flm shume ty dhe gjithe atyre qe ndihmojne dhe perkrahin forumin me te madh shqiptar.

----------


## Nice_Boy

```
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.site.al/index.html">
```

Ky kodte kalon Automatikisht kur ti don ta besh links nje webfaqe me nje tjeter..

----------


## lirimm

Kerkoj nje JavaScript i ci te dergon nje nje web faqe tjeter, e kam nje te ngjajshem por nuk po me dergon me nje here mbasi hapet faqja ime pastaj me dergon ne web faqen tjeter flm per te gjitha Pershendetje.

----------


## besart

Lirimm na trego me shum&#235;, e don skripten qe menjeher&#235; qe te hapet faqjajote te ridrejtohet n&#235; nj&#235; faqe tjet&#235;r apo si e don?
Na trego dhe do te ndihmojm&#235;!

----------


## Nice_Boy

> Kerkoj nje JavaScript i ci te dergon nje nje web faqe tjeter, e kam nje te ngjajshem por nuk po me dergon me nje here mbasi hapet faqja ime pastaj me dergon ne web faqen tjeter flm per te gjitha Pershendetje.




```
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.site.al/index.html">
```

Ky kodte kalon Automatikisht kur ti don ta besh links nje webfaqe me nje tjeter. 

ne vend te http://www.site.al/index.html shkruaje links me te cilin ti don ta besh links webfaqen tene psh http://www.Xxx125.de/index.html 

Ndoshta me kuptove.

----------


## viganv

Tung a ka mundesi me jap nje javascript i cili mundeson kete : *Si te futet dikush ne site tim te leshohet menjehere Radioja qe kam* dmth automatikisht a mundet dikush me ma ba ket nder.Flm

----------

