(JavaScript )معرفی کدهای جاوا اسکریپت, HTML و...

نویسنده Amir Shahbazzadeh, بعد از ظهر 19:19:53 - 06/27/11

« کد های کاربردی زبان XML | کد HTML گوگل پلاس(Google +1) »

0 اعضا و 7 کاربران مهمان درحال دیدن موضوع.

Amir Shahbazzadeh


اینم کد یک منوی متنی و تقریبا زیبا .



[color=navy]<HEAD>
<style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#ECECFF;
color:#000000;
width:140px;
padding:2px;
text-align:center;
font-weight:bold;
/*/*/border:1px solid #000000;/* */
}

.submenu{
margin-bottom: 0.5em;
}
</style>

<script type="text/javascript">

/***********************************************
* Switch Menu script- by Martial B of [url=http://getElementById.com/]http://getElementById.com/[/url]
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit [url=http://www.dynamicdrive.com/]http://www.dynamicdrive.com/[/url] for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

</script>
<!-- Keep all menus within masterdiv-->
<div id="masterdiv">

<div class="menutitle" onclick="SwitchMenu('sub1')">Site Menu</div>
<span class="submenu" id="sub1">
- <a href="new.htm">What's New</a><br>
- <a href="hot.htm">What's hot</a><br>
- <a href="revised.htm">Revised Scripts</a><br>
- <a href="morezone/">More Zone</a>
</span>

<div class="menutitle" onclick="SwitchMenu('sub2')">FAQ/Help</div>
<span class="submenu" id="sub2">
- <a href="notice.htm">Usage Terms</a><br>
- <a href="faqs.htm">DHTML FAQs</a><br>
- <a href="help.htm">Scripts FAQs</a>
</span>

<div class="menutitle" onclick="SwitchMenu('sub3')">Help Forum</div>
<span class="submenu" id="sub3">
- <a href="http://www.codingforums.com">Coding Forums</a><br>
</span>

<div class="menutitle" onclick="SwitchMenu('sub4')">Cool Links</div>
<span class="submenu" id="sub4">
- <a href="http://www.javascriptkit.com">JavaScript Kit</a><br>
- <a href="http://www.freewarejava.com">Freewarejava</a><br>
- <a href="http://www.cooltext.com">Cool Text</a><br>
- <a href="http://www.google.com">Google.com</a>
</span>

<img src="about.gif" onclick="SwitchMenu('sub5')"><br>
<span class="submenu" id="sub5">
- <a href="http://www.dynamicdrive.com/link.htm">Link to DD</a><br>
- <a href="http://www.dynamicdrive.com/recommendit/">Recommend Us</a><br>
- <a href="http://www.dynamicdrive.com/contact.htm">Email Us</a><br>
</span>

</div>[/color]

Amir Shahbazzadeh

اینم کد یک منو ی متحرک که در سمت راست سایتتون قرار می گیره .


[color=navy]</BODY>
<script>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft">

<!--EDIT BELOW CODE TO YOUR OWN MENU-->
<table border="1" width="130" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" bgcolor="#FFFFCC">
      <p align="center"><b><font size="4">Menu</font></b></td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#FFFFFF">
      <p align="left"> <a href="http://www.dynamicdrive.com">Dynamic Drive</a><br>
       <a href="http://www.dynamicdrive.com/new.htm">What's New</a><br>
       <a href="http://www.dynamicdrive.com/hot.htm">What's Hot</a><br>
       <a href="http://www.dynamicdrive.com/faqs.htm">FAQs</a><br>
       <a href="http://www.dynamicdrive.com/morezone/">More Zone</a></td>
  </tr>
</table>
<!--END OF EDIT-->

</layer>


<script type="text/javascript">

/*
Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="frombottom"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
var startX = 3,
startY = 150;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x;this.style.top=y;};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>[/color]

Amir Shahbazzadeh


یک منوی متنی دیگر واقعا جالبه این یکی . جای کم می گیره و مفیده .

[color=navy]<head>
<style type="text/css">

#popitmenu{
position: absolute;
background-color: white;
border:1px solid black;
font: normal 12px Verdana;
line-height: 18px;
z-index: 100;
visibility: hidden;
}

#popitmenu a{
text-decoration: none;
padding-left: 6px;
color: black;
display: block;
}

#popitmenu a:hover{ /*hover background color*/
background-color: #CCFF9D;
}

</style>

<script type="text/javascript">

/***********************************************
* Pop-it menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var defaultMenuWidth="150px" //set default menu width.

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]='<a href="http://dynamicdrive.com">Dynamic Drive</a>'
linkset[0]+='<hr>' //Optional Separator
linkset[0]+='<a href="http://www.javascriptkit.com">JavaScript Kit</a>'
linkset[0]+='<a href="http://www.codingforums.com">Coding Forums</a>'
linkset[0]+='<a href="http://www.cssdrive.com">CSS Drive</a>'
linkset[0]+='<a href="http://freewarejava.com">Freewarejava</a>'

linkset[1]='<a href="http://msnbc.com">MSNBC</a>'
linkset[1]+='<a href="http://cnn.com">CNN</a>'
linkset[1]+='<a href="http://news.bbc.co.uk">BBC News</a>'
linkset[1]+='<a href="http://www.washingtonpost.com">Washington Post</a>'

////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu

</script>
<a href="#" onMouseover="showmenu(event,linkset[0])" onMouseout="delayhidemenu()">Webmaster Links</a><br>
<a href="#" onMouseover="showmenu(event,linkset[1], '180px')" onMouseout="delayhidemenu()">News sites</a>[/color
]

Amir Shahbazzadeh


یک منوی متنی دیگر واقعا جالبه این یکی . جای کم می گیره و مفیده .


[color=navy]<head>
<style type="text/css">

#popitmenu{
position: absolute;
background-color: white;
border:1px solid black;
font: normal 12px Verdana;
line-height: 18px;
z-index: 100;
visibility: hidden;
}

#popitmenu a{
text-decoration: none;
padding-left: 6px;
color: black;
display: block;
}

#popitmenu a:hover{ /*hover background color*/
background-color: #CCFF9D;
}

</style>

<script type="text/javascript">

/***********************************************
* Pop-it menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var defaultMenuWidth="150px" //set default menu width.

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]='<a href="http://dynamicdrive.com">Dynamic Drive</a>'
linkset[0]+='<hr>' //Optional Separator
linkset[0]+='<a href="http://www.javascriptkit.com">JavaScript Kit</a>'
linkset[0]+='<a href="http://www.codingforums.com">Coding Forums</a>'
linkset[0]+='<a href="http://www.cssdrive.com">CSS Drive</a>'
linkset[0]+='<a href="http://freewarejava.com">Freewarejava</a>'

linkset[1]='<a href="http://msnbc.com">MSNBC</a>'
linkset[1]+='<a href="http://cnn.com">CNN</a>'
linkset[1]+='<a href="http://news.bbc.co.uk">BBC News</a>'
linkset[1]+='<a href="http://www.washingtonpost.com">Washington Post</a>'

////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu

</script>
<a href="#" onMouseover="showmenu(event,linkset[0])" onMouseout="delayhidemenu()">Webmaster Links</a><br>
<a href="#" onMouseover="showmenu(event,linkset[1], '180px')" onMouseout="delayhidemenu()">News sites</a>[/color][/code[/left]]


Amir Shahbazzadeh


نوری به دنبال موس شما .


[color=navy]<BODY>
<script language="JavaScript">

//Comment trail script- By Kurt (kurt.grigg@virgin.net)
//Script featured on Dynamic Drive
//Visit http://www.dynamicdrive.com for this script and more

colours=new Array('#ff0000','#00ff00','#ffffff','#ff00ff','#ffa500','#ffff00','#00ff00','#ffffff','ff00ff')
n = 10;
y = 0;
x = 0;
n6=(document.getElementById&&!document.all);
ns=(document.layers);
ie=(document.all);
d=(ns||ie)?'document.':'document.getElementById("';
a=(ns||n6)?'':'all.';
n6r=(n6)?'")':'';
s=(ns)?'':'.style';
if (ns){
for (i = 0; i < n; i++)
document.write('<layer name="dots'+i+'" top=0 left=0 width='+i/2+' height='+i/2+' bgcolor=#ff0000></layer>');
}
if (ie)
document.write('<div id="con" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
if (ie||n6){
for (i = 0; i < n; i++)
document.write('<div id="dots'+i+'" style="position:absolute;top:0px;left:0px;width:'+i/2+'px;height:'+i/2+'px;background:#ff0000;font-size:'+i/2+'"></div>');
}
if (ie)
document.write('</div></div>');
(ns||n6)?window.captureEvents(Event.MOUSEMOVE):0;
function Mouse(evnt){
y = (ns||n6)?evnt.pageY+4 - window.pageYOffset:event.y+4;
x = (ns||n6)?evnt.pageX+1:event.x+1;
}
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
function animate(){
o=(ns||n6)?window.pageYOffset:0;
if (ie)con.style.top=document.body.scrollTop;
for (i = 0; i < n; i++){
var temp1 = eval(d+a+"dots"+i+n6r+s);

randcolours = colours[Math.floor(Math.random()*colours.length)];
(ns)?temp1.bgColor = randcolours:temp1.background = randcolours;
if (i < n-1){
var temp2 = eval(d+a+"dots"+(i+1)+n6r+s);
temp1.top = parseInt(temp2.top);
temp1.left = parseInt(temp2.left);
}
else{
temp1.top = y+o;
temp1.left = x;
}
}
setTimeout("animate()",10);
}
animate();
// -->
</script>[/color]

Amir Shahbazzadeh


پنهان کردن اسکريپتهاي جاوا از دست مرورگرهاي قديمي


[color=navy] <html>
<head>
</head>

<body>

<h1>

<!-- hide script from old browsers -->

<script language="javascript" type="text/javascript">

document.write("IranJavaScript")

//end hiding script from old browsers -->
</script>
</h1>

</body>
</html>[/color]

Amir Shahbazzadeh


تغيير رنگ پس زمينه هنگام ورود به صفحه


[color=navy]<script>
// Modified by CoffeeCup Software

function initArray()
{
this.length = initArray.arguments.length
for (var i = 0; i < this.length; i++)
this[i+1] = initArray.arguments[i]
}

var hexChars = "0123456789ABCDEF";

function Dec2Hex (Dec)
{
var a = Dec % 16;
var b = (Dec - a)/16;
hex = "" + hexChars.charAt(b) + hexChars.charAt(a);
return hex;
}

function bgChanger (begin, end, steps)
{
steps = steps -1 ;

redA = begin.charAt(0) + begin.charAt(1);
red_valA = parseInt(redA,'16');
redB = end.charAt(0) + end.charAt(1);
red_valB = parseInt(redB,'16');
red_int = ((red_valB - red_valA) / steps) * -1;
grnA = begin.charAt(2) + begin.charAt(3);
grn_valA = parseInt(grnA,'16');
grnB = end.charAt(2) + end.charAt(3);
grn_valB = parseInt(grnB,'16');
grn_int = ((grn_valB - grn_valA) / steps) * -1;
bluA = begin.charAt(4) + begin.charAt(5);
blu_valA = parseInt(bluA,'16');
bluB = end.charAt(4) + end.charAt(5);
blu_valB = parseInt(bluB,'16');
blu_int = ((blu_valB - blu_valA) / steps) * -1;

step = 2;
red = red_valA;
grn = grn_valA;
blu = blu_valA;

document.bgColor = begin;

while ( steps >= step )
{
red -= red_int;
red_round = Math.round(red);
red_hex = Dec2Hex(red);

grn -= grn_int;
grn_round = Math.round(grn);
grn_hex = Dec2Hex(grn);

blu -= blu_int;
blu_round = Math.round(blu);
blu_hex = Dec2Hex(blu);

document.bgColor = red_hex + grn_hex + blu_hex;

step++;
}
document.bgColor = end;
}

</script>
</head>
<body bgcolor=#000000 text=#FFFFFF link="FF0000" vlink="8888FF"

alink="FF00FF">
<script>
<!--
// black to black (pause)
bgChanger("000000","000000",25);
// black to red
bgChanger("000000","FF0000",25);
// red to black
bgChanger("FF0000","000000",25);
// black to purple
bgChanger("000000","AA00EE",25);
// purple to black
bgChanger("AA00EE","000000",25);
// black to blue
bgChanger("000000","0000FF",25);
// blue to black
bgChanger("0000FF","000000",25);
// black to black (pause)
bgChanger("000000","000000",25);
// -->
</script>
</head>
<body>
<BODY BGCOLOR=000000 text="#ffffff" link="#0000ff"

vlink="#c00c0">


_____________________________________________________
تنظيم يک فيلد بر اساس فيلد ديگر

<html>
<head>
<script language="javascript" type="text/javascript">
function SubmitIt(carForm) {
doorOption = -1

if (carForm.DoorCt[doorOption].value == "fourDoor" && carForm.sunroof.checked) {
alert("The sunroof is only available on the two door model")
return false
}
return true
}

function doorSet(sunroofField) {
if (sunroofField.checked) {
for (i=0; i<document.myForm.DoorCt.length; i++) {
if (document.myForm.DoorCt[i].value == "twoDoor") {
document.myForm.DoorCt[i].checked = true
}
}
}
}
</script>
</head>
<body>
<h2>
Car Picker<p>
<form onSubmit="return SubmitIt(this)" action="ok.asp" name="myForm">
Doors:
<br>
<input type="CHECKBOX" name="sunroof" value="YES" onClick="doorSet(this)">Sunroof(two door only)
<br><br>
<input type="radio" value="twoDoor" name="DoorCt">two
<input type="radio" value="fourDoor" name="DoorCt">Four
<br>

<input type="Submit" value="Submit">
</form></h2>
</body>
</html>[/color]

Amir Shahbazzadeh


كد براي قرار دادن فايل هل ( لوگو ... بنر و.... ) فلش در وبلاگ يا سايت :



[color=navy]<<embed width="128" height="128" src="url.swf"></p>
</body>
</html>[/color]

Amir Shahbazzadeh


انتخاب رنگ پس زمينه:


[color=navy]<body>
<script language="Javascript">
<!--
// please keep these lines on when you copy the source
// made by: Amir - http://www.IranJavaScript.com

function backbs(clr) {
document.bgColor = clr
}
<!--Template Name:"Asre Jadid"-By:Amin Asemi E.For Persianblog's blog-->
//-->
</script>
<form>
<input type="button" value="zard" onclick="backbs('yellow')">
<input type="button" value="khaki" onclick="backbs('khaki')">
<input type="button" value="sefid" onclick="backbs('white')">
<input type="button" value="toosi" onclick="backbs('gray')">
<input type="button" value="meshki" onclick="backbs('black')">
<input type="button" value="soorati" onclick="backbs('pink')">
<input type="button" value="abi" onclick="backbs('blue')">
<input type="button" value="sabz" onclick="backbs('Green')">
<input type="button" value="noghre ei" onclick="backbs('silver')">
<input type="button" value="sabz tire" onclick="backbs('teal')">
<input type="button" value="limooei" onclick="backbs('lime')">
<input type="button" value="abi nafti" onclick="backbs('navy')">
<input type="button" value="ghermez" onclick="backbs('red')">
<input type="button" value="narenji" onclick="backbs('orange')">
<input type="button" value="ghahve ei" onclick="backbs('olive')">
<input type="button" value="banafsh" onclick="backbs('purple')">
</form>
</script>
</body>[/color]

Amir Shahbazzadeh


با انجام عمل Double Click عمل خاصي را مشاهده خواهيد كرد
براي عمل onDbclick Event

onDblclick="newWindow(1)"

بدين صورت با دوبار کليک بر روي تصوير کوچک, تصوير بزرگ آن در پنجره جديد نمايش داده ميشود.



<html>
<head>
<script language="javascript" type="text/javascript">
function newWindow(imgNumber) {
imgName = "images/test" + imgNumber + ".gif"
imgWindow = window.open(imgName,"imgWin","width=320,height=240,scrollbars=no")
}
</script>
</head>
<body>
<h2>Double-click on an image to see the full-size version</h2>
<img src="images/test1.gif" border="2" onDblclick="newWindow(1)">
<img src="images/test2.gif" border="2" onDblclick="newWindow(2)">
<img src="images/test3.gif" border="2" onDblclick="newWindow(3)">

</body>
</html>

Tags:

Share via facebook Share via linkedin Share via telegram Share via twitter Share via whatsapp

https://www.meta4u.com/forum/Themes/Comet/images/post/xx.png
کد اچ تی ام ال HTML همراه با جاوا اسکریپت javascript پاپ آپ pop-up

نویسنده guld118 در زبان های برنامه نویسی

0 ارسال
1490 مشاهده
آخرین ارسال: قبل از ظهر 04:53:36 - 07/21/18
توسط
guld118
https://www.meta4u.com/forum/Themes/Comet/images/post/xx.png
پلاگین توسعه و ویرایش زبان های برنامه نویسی CSS, HTML, and JavaScript با Firebug

نویسنده Amir Shahbazzadeh در مرورگر فاير فاكس, Firefox Browser

0 ارسال
1476 مشاهده
آخرین ارسال: قبل از ظهر 02:34:22 - 08/23/13
توسط
Amir Shahbazzadeh
https://www.meta4u.com/forum/Themes/Comet/images/post/xx.png
معرفی کامل HTML

نویسنده Zohreh Gholami در زبان های برنامه نویسی

4 ارسال
3234 مشاهده
آخرین ارسال: قبل از ظهر 11:58:31 - 09/06/11
توسط
Zohreh Gholami
https://www.meta4u.com/forum/Themes/Comet/images/post/xx.png
فعال کردن جاوا اسکریپت در مرورگر سافاری, Safari Browser

نویسنده Amir Shahbazzadeh در مرورگر سافاري, Safari Browser

0 ارسال
3270 مشاهده
آخرین ارسال: بعد از ظهر 13:47:54 - 04/12/12
توسط
Amir Shahbazzadeh
https://www.meta4u.com/forum/Themes/Comet/images/post/xx.png
فعال کردن جاوا اسکریپت در مرورگر فایر فاکس, Firefox Browser

نویسنده Amir Shahbazzadeh در مرورگر فاير فاكس, Firefox Browser

4 ارسال
19464 مشاهده
آخرین ارسال: بعد از ظهر 15:00:25 - 04/04/14
توسط
Amir Shahbazzadeh
https://www.meta4u.com/forum/Themes/Comet/images/post/xx.png
آموزش تصویری فعال کردن فعال کردن جاوا اسکریپت در مرورگر اپرا, Opera Browser

نویسنده Amir Shahbazzadeh در مرورگر اپرا, Opera Browser

0 ارسال
5232 مشاهده
آخرین ارسال: قبل از ظهر 00:27:45 - 04/11/12
توسط
Amir Shahbazzadeh
https://www.meta4u.com/forum/Themes/Comet/images/post/xx.png
آموزش تصویری فعال کردن فعال کردن جاوا اسکریپت در مرورگر Internet Explorer

نویسنده Amir Shahbazzadeh در مرورگر اينترنت اكسپلورر, Internet Explorer Browser

0 ارسال
5995 مشاهده
آخرین ارسال: قبل از ظهر 00:17:38 - 04/11/12
توسط
Amir Shahbazzadeh