html ile random resim
6
●828
- 18-01-2010, 21:40:48Kimlik doğrulama veya yönetimden onay bekliyor.Javascript kullanarak yapabilirsin. Sanırım aşağıdaki link işine yarayacaktır:
http://www.999tutorials.com/javascri...th-javascript/ - 24-01-2010, 01:06:26üstad verdiğin kodu kurcaladımda resimleri çeceği klasöru bulduramadım ve yine arama yaparak şöyle birşeye ulaştım.
<script type="text/javascript"> <!-- var imlocation = "resimler/"; var currentdate = 0; var image_number = 0; function ImageArray (n) { this.length = n; for (var i =1; i <= n; i++) { this[i] = ' ' } } image = new ImageArray(3) image[0] = 'image1.gif' image[1] = 'image2.gif' image[2] = 'image3.gif' var rand = 60/image.length function randomimage() { currentdate = new Date() image_number = currentdate.getSeconds() image_number = Math.floor(image_number/rand) return(image[image_number]) } document.write("<img src='" + imlocation + randomimage()+ "'>"); //--> </script>
bundada sorun her defasında yenilenmiyor belli sn lerle yenileniyor uamrım anlatabilmişimdir. - 24-01-2010, 01:34:51o sitedeki gibi istiyorsan onu çek ordan... aşağıdaki kodlar o sitedeki js kodlarıdır...
var useragent = navigator.userAgent; var bName = (useragent.indexOf('Opera') > -1) ? 'Opera' : navigator.appName; var pos = useragent.indexOf('MSIE'); if (pos > -1) { bVer = useragent.substring(pos + 5); var pos = bVer.indexOf(';'); var bVer = bVer.substring(0,pos); } var pos = useragent.indexOf('Opera'); if (pos > -1) { bVer = useragent.substring(pos + 6); var pos = bVer.indexOf(' '); var bVer = bVer.substring(0, pos); } if (bName == "Netscape") { var bVer = useragent.substring(8); var pos = bVer.indexOf(' '); var bVer = bVer.substring(0, pos); } if (bName == "Netscape" && parseInt(navigator.appVersion) >= 5) { var pos = useragent.lastIndexOf('/'); var bVer = useragent.substring(pos + 1); } if (bName == "Microsoft Internet Explorer") { document.writeln('<'+'link rel="stylesheet" type="text/css" href="ie.css" />'); } else { document.write('<'+'link rel="stylesheet" href="menu.css" />'); } /* // OLD CODE FROM NAVIGATION VERSION 1 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') } */ press_on = new Image(72,55); press_on.src = "images/menu/press_on.gif"; press = new Image(72,55); press.src = "images/menu/press.gif"; fin_statements_on = new Image(72,55); fin_statements_on.src = "images/menu/fin_statements_on.gif"; fin_statements = new Image(72,55); fin_statements.src = "images/menu/fin_statements.gif"; contact_on = new Image(72,55); contact_on.src = "images/menu/contact_on.gif"; contact = new Image(72,55); contact.src = "images/menu/contact.gif"; global1_on = new Image(72,55); global1_on.src = "images/menu/global_on.gif"; global1 = new Image(72,55); global1.src = "images/menu/global.gif"; apparel_on = new Image(72,55); apparel_on.src = "images/menu/apparel_on.gif"; apparel = new Image(72,55); apparel.src = "images/menu/apparel.gif"; zips_on = new Image(72,55); zips_on.src = "images/menu/zips_on.gif"; zips = new Image(72,55); zips.src = "images/menu/zips.gif"; speciality_on = new Image(72,55); speciality_on.src = "images/menu/speciality_on.gif"; speciality = new Image(72,55); speciality.src = "images/menu/speciality.gif"; crafts_on = new Image(72,55); crafts_on.src = "images/menu/crafts_on.gif"; crafts = new Image(72,55); crafts.src = "images/menu/crafts.gif"; key_dates_on = new Image(72,55); key_dates_on.src = "images/menu/key_dates_on.gif"; key_dates = new Image(72,55); key_dates.src = "images/menu/key_dates.gif"; advisors_on = new Image(72,55); advisors_on.src = "images/menu/advisors_on.gif"; advisors = new Image(72,55); advisors.src = "images/menu/advisors.gif"; corp_gov_on = new Image(72,55); corp_gov_on.src = "images/menu/corp_gov_on.gif"; corp_gov = new Image(72,55); corp_gov.src = "images/menu/corp_gov.gif"; global2_on = new Image(72,55); global2_on.src = "images/menu/global_on.gif"; global2 = new Image(72,55); global2.src = "images/menu/global.gif"; ourbrands_on = new Image(72,55); ourbrands_on.src = "images/menu/ourbrands_on.gif"; ourbrands = new Image(72,55); ourbrands.src = "images/menu/ourbrands.gif"; about_on = new Image(72,55); about_on.src = "images/menu/about_us_on.jpg"; about = new Image(72,55); about.src = "images/menu/about_us.jpg"; newsroom_on = new Image(72,55); newsroom_on.src = "images/menu/newsroom_on.gif"; newsroom = new Image(72,55); newsroom.src = "images/menu/newsroom.gif"; investor_on = new Image(72,55); investor_on.src = "images/menu/investor_on.gif"; investor = new Image(72,55); investor.src = "images/menu/investor.gif"; board_on = new Image(72,55); board_on.src = "images/menu/board_on.gif"; board = new Image(72,55); board.src = "images/menu/board.gif"; management_on = new Image(72,55); management_on.src = "images/menu/management_on.gif"; management = new Image(72,55); management.src = "images/menu/management.gif"; hist_info_on = new Image(72,55); hist_info_on.src = "images/menu/hist_info_on.gif"; hist_info = new Image(72,55); hist_info.src = "images/menu/hist_info.gif"; coats_ss_on = new Image(72,55); coats_ss_on.src = "images/menu/coats_ss_on.jpg"; coats_ss = new Image(72,55); coats_ss.src = "images/menu/coats_ss.jpg"; coats_crafts_on = new Image(72,55); coats_crafts_on.src = "images/menu/coats_crafts_on.jpg"; coats_crafts = new Image(72,55); coats_crafts.src = "images/menu/coats_crafts.jpg"; home_on = new Image(72,55); home_on.src = "images/menu/home_on.gif"; home = new Image(72,55); home.src = "images/menu/home.gif"; contact_us_on = new Image(72,55); contact_us_on.src = "images/menu/contact_us_on.gif"; contact_us = new Image(72,55); contact_us.src = "images/menu/contact_us.gif"; head_office_on = new Image(72,55); head_office_on.src = "images/menu/head_office_on.gif"; head_office = new Image(72,55); head_office.src = "images/menu/head_office.gif"; global_op_on = new Image(72,55); global_op_on.src = "images/menu/global_op_on.gif"; global_op = new Image(72,55); global_op.src = "images/menu/global_op.gif"; img1755 = new Image(72,55); img1755.src = "images/misc/history1.jpg"; img1864 = new Image(72,55); img1864.src = "images/misc/history2.jpg"; img1890 = new Image(72,55); img1890.src = "images/misc/history3.jpg"; img1950 = new Image(72,55); img1950.src = "images/misc/history4.jpg"; img1961 = new Image(72,55); img1961.src = "images/misc/history5.jpg"; img2000 = new Image(72,55); img2000.src = "images/misc/history6.jpg"; img2001 = new Image(72,55); img2001.src = "images/misc/history7.jpg"; img2003 = new Image(72,55); img2003.src = "images/misc/history8.jpg"; img1986 = new Image(72,55); img1986.src = "images/misc/history9.jpg"; img2004 = new Image(72,55); img2004.src = "images/misc/history10.jpg"; ic = 5; ic2 = 2; image = new Array(ic); image2 = new Array(ic2); imageHeight = new Array(ic); imageWidth = new Array(ic); imageHeight2 = new Array(ic2); imageWidth2 = new Array(ic2); image[0] = "images/misc/homepage1.jpg"; image[1] = "images/misc/homepage2.jpg"; image[2] = "images/misc/homepage3.jpg"; image[3] = "images/misc/homepage4.jpg"; image[4] = "images/misc/homepage5.jpg"; imageWidth[0] = 620; imageHeight[0] = 375; imageWidth[1] = 570; imageHeight[1] = 375; imageWidth[2] = 590; imageHeight[2] = 375; imageWidth[3] = 655; imageHeight[3] = 285; imageWidth[4] = 535; imageHeight[4] = 285; image2[0] = "images/misc/speciality1.jpg"; image2[1] = "images/misc/speciality2.jpg"; imageWidth2[0] = 494; imageHeight2[0] = 366; imageWidth2[1] = 486; imageHeight2[1] = 345; intro = new Array(ic); introHeight = new Array(ic); introWidth = new Array(ic); introAlt = new Array(ic); intro[0] = "images/intro/homepage_intro_1.gif"; intro[1] = "images/intro/homepage_intro_2.gif"; intro[2] = "images/intro/homepage_intro_3.gif"; intro[3] = "images/intro/homepage_intro_4.gif"; intro[4] = "images/intro/homepage_intro_1.gif"; introWidth[0] = 241; introHeight[0] = 105; introWidth[1] = 234; introHeight[1] = 105; introWidth[2] = 247; introHeight[2] = 124; introWidth[3] = 234; introHeight[3] = 107; introWidth[4] = 241; introHeight[4] = 105; introAlt[0] = "Coats plc. Global leader in sewing thread and needlecraft products. Over twenty-five thousand empoyees in 67 countries, around the world."; introAlt[1] = "Coats plc. Global leader in sewing thread and needlecraft products. Millions of consumers in 67 countries around the world."; introAlt[2] = "Coats plc. Global leader in sewing thread and needlecraft products. Established in 1755 and still producing some of the worlds best loved thread and needlecraft brands."; introAlt[3] = "Coats plc. Global leader in sewing thread and needlecraft products. Unbeatable service and technical support in 67 countries worldwide."; introAlt[4] = "Coats plc. Global leader in sewing thread and needlecraft products. Over twenty-five thousand empoyees in 67 countries, around the world."; var choice = pickRandom(ic); var choice2 = pickRandom(ic2); function pickRandom(range) { if (Math.random) return Math.round(Math.random() * (range-1)); else { var now = new Date(); return (now.getTime() / 1000) % range; } } function pasuser(form) { if (form.id.value=="coatsplc") { if (form.pass.value=="password1") { location="index.htm"; } else { alert("Invalid Password"); } } else { alert("Invalid UserID"); } } function imageOn(imgDocID, imgObjName, comment){ document.images[imgDocID].src = eval(imgObjName + ".src"); window.status = comment; return true; } function histImage(imgDocID, imgObjName){ document.images[imgDocID].src = eval(imgObjName + ".src"); return true; } /* // OLD CODE FROM NAVIGATION VERSION 1 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 */ // START OF JAVASCRIPT FOR LINE INDUSTRIES EXPANDING NAVIGATION function ShowHideBlock(tag) { var newState = ""; var State2 = ""; if (document.getElementById) // Mozilla var state = document.getElementById('item' + tag).style.display else if (document.all) // IE var state = document.all['item' + tag].style.display; // CHANGE THE ARRAY HERE FOR THE NUMBER OF ITEMS IN THE NAVIGATION for (i=1; i<5; i++) { if (document.getElementById) document.getElementById('item' + i).style.display = "none"; else if (document.all) document.all['item' + i].style.display = "none"; } if (state == "block") newState = "none" else newState = "block"; if (document.getElementById) document.getElementById('item' + tag).style.display = newState; else if (document.all) document.all['item' + tag].style.display = newState; }