JavaScript - Chess Engine Header Help
Hey all, I have the old Yahoo! chess engine and Im making a webpage with a chessboard. Currently everything involved with this chessboard is wrapped up inside the code and dynamically creates everything it needs to operate.
I have made a few customizations on several elements such as the PHP dropdown box that it dynamically creates as a quickjump to games. But i am wondering if someone wouldn't mind helping me in finding a way to write an amendment that reads 3 parts of the pgn file (Black)(Result)(White) (which it already does read them but just shows the info in the dropdown box) and display them as a header to the board. Everything in this script as far as variables go, are numbers... which makes it difficult at best which makes visual mapping harder. So I thought I would ask a professional what I should be looking for in the script so that I can go ahead and modify it and reuse some functionality to display a game header from javascript. The pgn viewer will read either string format directly input into the setup configuration in the html page, or it will read from a file. It them parses the elements based on the pgn tags. PHP Code: var tag=this.parseTag("FEN",pgn,i); if(tag&&tag!="?"){ this.board.startFen=tag; }else{ tag=this.parseTag("White",pgn,i); if(tag&&tag!="?"){ _68=tag; }else{ tag=this.parseTag("Black",pgn,i); if(tag&&tag!="?"){ _63=tag; }else{ tag=this.parseTag("Result",pgn,i); if(tag&&tag!="?"){ _62=tag; }else{ tag=this.parseTag("Event",pgn,i); if(tag&&tag!="?"){ _64=tag; }else{ tag=this.parseTag("Site",pgn,i); if(tag&&tag!="?"){ _65=tag; }else{ tag=this.parseTag("Date",pgn,i); if(tag&&tag!="?"){ _66=tag; So the variables I want to use are _68, _63, & _62 and display them as a header to the board. Any help is appreciated. Similar TutorialsI'm trying to build a small chess like gaming engine, and i'm wondering what soulution would be better. To try and create the whole board in javascript, or to use flash instead! Problem is that is that i kinda don't have money to buy adobe/macromedia/flash but javascript could be a bit more difficult couse of browser limitations.. been searching everywhere for help on this javascript kit but no luck JSE internal seach engine v 1.0a http://www.javascriptkit.com/script/...se/index.shtml Description: JSE is a highly robust, 100% client side search engine for indexing and searching your own site, using JavaScript 1.3. Some of JSE's noteworthy features a * Uses regular expressions to efficiently and rapidly search the index for matches based on the entered keywords. Supports basic logic (ie: negation). * Returns the results on a seperate page from the search form itself, neatly formatted. Uses session cookies to transmit the query between the two pages. * Stores the index (url, keywords and description for each page you wish to be "crawled") in the "results" page. This means the index is loaded only when a search has actually been performed, saving on bandwidth and download time. * Searches title, description and desingated keywords within the index for a match. * Works in IE4+, NS4, and NS6+. its perfectly working on local server but when I uploaded my files to my webserver. it doesn't work. Is there anybody can help me with this? TIA I am new to Javascript and I downloaded JSE internal search engine v 1.0a from CodingForums. It works fine in all browsers other than ie6 and ie7. Have confirmed that other javascripts are working in these browsers so it is not my browser settings. Can anyone help?
Hi everyone, I have a very simple question. I found some answers on the web but nothing quite concluding. I am hearing Search Engine can only be build with server-side programming or through google (which means your site must be connected to the internet. Is it possible to build a simple yet effective search engine for an in-house site (not connected to the net, only network) with JavaScript? My understanding is that, using arrays, once a user enter a word in a fied, the program would need to index all the pages containing the word. Then the program would need to target each seperate paragraph containing the word. Also what if the results must lead you to a document which must open in an iframe? Possible? How? Cheers How would you create a text field that allows users to select different search engines, and then search their keyword. Essentially what I'm looking for is a something similar to the default multiple search field that you see in Firefox and Safari. At this point in time I have the multiple search feature implemented. But all I really have is a <select> next to a <input>. What I want is something that combines the two. Basically I want the look and feel of Firefox/Safari default multiple search field. Any help would be appreciated. Thanks, Yeah, it's that internal search engine script again. But before you click away, I'd like to ask whether anyone can solve a problem I've come up against... I have minimally changed the script to present results with a clickable url (this is my attempt at creating an image search engine, hence having to use this method). The problem I have suddenly encountered however is that the urls, while they read complete, they only link one directory deep into my website. For example: Reads as: http://www.mysite.com/search/set1/doctor.jpg Link is: http://www.mysite.com/search As you will see, I've omitted using the numbering array and have rearranged the order in which the values for how the search results are called. Code: if (include_num == 1) { document.write(a + 1, '. <a href="', os[0], '">', os[1], '</a><br>', os[2], '<p>'); } else { document.write('<a href="', os[0], '">', os[1], '</a><br>', os[2], '<p>'); } It is with this second point that I fear I have caused the damage. Code: // ---------- script properties ---------- var include_num = 0; var bold = 1; // ---------- sites ---------- var s = new Array(); s[0] = "^this will be added soon/form.html^Click to view image^"; s[0] = "^this will be added soon/doc.txt^Click to view image^"; s[0] = "^http://mysite.net/archive/Gliding/folderthumb.jpg^Click to view image^"; s[0] = "^this will be added soon/doctor.txt^^"; // ---------- end of script properties and sites ---------- var cookies = document.cookie; var p = cookies.indexOf("d="); if (p != -1) { var st = p + 2; var en = cookies.indexOf(";", st); if (en == -1) { en = cookies.length; } var d = cookies.substring(st, en); d = unescape(d); } var od = d; var m = 0; if (d.charAt(0) == '"' && d.charAt(d.length - 1) == '"') { m = 1; } var r = new Array(); var co = 0; if (m == 0) { var woin = new Array(); var w = d.split(" "); for (var a = 0; a < w.length; a++) { woin[a] = 0; if (w[a].charAt(0) == '-') { woin[a] = 1; } } for (var a = 0; a < w.length; a++) { w[a] = w[a].replace(/^\-|^\+/gi, ""); } a = 0; for (var c = 0; c < s.length; c++) { pa = 0; nh = 0; for (var i = 0; i < woin.length; i++) { if (woin[i] == 0) { nh++; var pat = new RegExp(w[i], "i"); var rn = s[c].search(pat); if (rn >= 0) { pa++; } else { pa = 0; } } if (woin[i] == 1) { var pat = new RegExp(w[i], "i"); var rn = s[c].search(pat); if (rn >= 0) { pa = 0; } } } if (pa == nh) { r[a] = s[c]; a++; } } co = a; } if (m == 1) { d = d.replace(/"/gi, ""); var a = 0; var pat = new RegExp(d, "i"); for (var c = 0; c < s.length; c++) { var rn = s[c].search(pat); if (rn >= 0) { r[a] = s[c]; a++; } } co = a; } function return_query() { document.jse_Form.d.value = od; } function num_jse() { document.write(co); } function out_jse() { if (co == 0) { document.write('Your search did not match any images currently on file.<p>Make sure all keywords are spelt correctly.<br>Alternatively, view the Unknown Section of the Archive and help us put a name and date to your memories.'); return; } for (var a = 0; a < r.length; a++) { var os = r[a].split("^"); if (bold == 1 && m == 1) { var br = "<b>" + d + "</b>"; os[2] = os[2].replace(pat, br); } if (include_num == 1) { document.write(a + 1, '. <a href="', os[0], '">', os[1], '</a><br>', os[2], '<p>'); } else { document.write('<a href="', os[0], '">', os[1], '</a><br>', os[2], '<p>'); } } } Because of the nature of the site (it will have over 600 images eventually), my level of understanding and the obviously limitations with this script, I'm looking for a solution that doesn't require a different edit for each entry. So far I have been able to simply drop a block of urls into this script (having planted a .php script to get the image directory listing) and then 'replace all' text that needs to be edited. In short, how do I ensure that the hyperlink for the url that is returned in the search query is full and not truncated to the first directory? ANY help in the matter would be really appreciated. Thank you in advance, Sam Can anyone get me a simple script for a search engine for my website? i cant find a decent 1 anywhere. thanks
Hey guys, While I know you cannot use javascript for SEO, I need something similar. What I need is something like a search and replace program or something that does this: it takes aspects of the filename and incorparates it into the meta tags. For example, if a file was named "1x9.html" I would want it to edit the meta tag Season 1 Episode 9 I was just wondering if you guys know if such a thing exists. Like I would write a script or something in the program, saying for it to search and replace meta tags in file names, and it would 1. Analyze the filename (for this example it will be "1x9.html" 2. Input " Season 1 Episode 9 " into the meta tags (analyzing the first character in "1x9" as [Season] [First Character] , analyzing the "x" in 1x9 as [Episode] and analyzing the last character in "1x9" as [Last Character] I need to do this for like 80 thousand files, and I cannot do it 1 by 1. All of the elements that need to be in the meta tags already exist in the webpage contents or webpage filename. I was wondering if you guys know the best way for me to go about this? Some background might better help my actual problem. Feel free to address either with any relevant insights. While attempting to create a greasemonkey script in FF2 (don't ask), I discovered that the "let" statement was causing my code to fail. After confirming that this statement has been available since FF2 (js engine 1.7) https://developer.mozilla.org/en/New_in_JavaScript_1.7, I became curious as one determines their javascript engine in FF. IE has a way to inspect the jscript engine, ala http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx , but I couldn't find anything similar for FF. Feel free to list links for testing engines in other browsers, too. I can't use irc at work, so it's good to know this place is still around for numb-nuts like me. :-) Many, many thanks (in-advance). I have been playing with this for a week and think I may need to move on but thought I would try you guys. I need a java script search engine for my site that I can manually enter keywords and direct the results to certain url locations. I thought I found one called JSE Search Engine and it works great in my adobe golive preview but when i upload the files the results dont show up. Very frustrating. Thought maybe someone might be familiar with it or at this point have a script to do what I need that is less of a headache. Thanks in advance for any help.
Say that I've got the following XML Code: <document> <block key="block1"> <p>This is a <bold>paragraph</bold></p> </block> <block key="block2"> <p>Additional paragraph</p> </block> </document> Obviously the schematics of this data and the constraints placed upon them can be described using XSD. For example, the following rules would apply: * must be a document element as the top-level parent element * must be at least one block element as a child of document * each block must have a unique key value * blocks can have 1...n p child elements. * p elements can have 0...n bold child elements What I'm looking for is an engine that executes on the client-side (JavaScript / jQuery) that can parse the XSD and flag any errors. In addition I would also need to be able to interrogate the engine in order to determine what are valid child nodes at a particular level of the XML. For example, the following types of queries might be asked of the engine: * Q: Is the overall XML valid? A: yes / no + report * Q: I'm looking at the element block (key="block2"). What are the valid child elements of this element? A: p (1...n). * Q: I'm looking at the element p in the first block (key="block1"). What are the valid child elements of this element? A: #text, bold (0...n). Determining the valid child elements of a particular element is something akin to how Visual Studio e.g. 2010 uses Intellisense. For example, given a schema Visual Studio let's you know what the valid elements are at a particular position as you type enter the XML. Finally I've mentioned XSD / XML above but we do not necessarily have to be constrained to these technologies so alternative ideas will be appreciated equally as well. Thank you for taking the time to examine my post. Well, this is only beginning and kinda beta, but this is just awesome! This is 100% secured, but yet unfinished. This is huuuuuge! I've created temporal apache server on my computer to show how it works: http://80.222.127.106/downloads.php Hi guys, i've been the last few days around a script that i can't make it work, i'm a beginner in javascript so if you guys could help me i'd appreciated. This script is a search engine, when you look for something say the word "titanic" , he shows you a list of results with numbers, being the first link with the higher number (kinda like a score), and then after u click the link you want he goes to the respective page. Now i want him to skip the results page, and directly open the first link that he founds on the page. The Script __________________________ <!-- Begin var item = new Array(); // Just enter as many additional pages that you want to search, then fill in he // additional listings for each page. // "Page Name","path","Page Title","Many,Key,Words","Descriptive Comments" c=0; item[c]=new Array("centerif.htm","","titanic","index,main,start,home,front","Demonstration search engine data about an imagined but probable internet site."); c++; item[c]=new Array("indexg.htm","","About Me","about,author,contact,email,who","Contact details and general information about the creator of the site and what the site is about."); c++; item[c]=new Array("links.htm","","Links page","links,more,where,similar,friends","Links to my favourite sites which I find interesting. Other friends sites which have similar interests to my own."); c++; item[c]=new Array("main.htm","main/","Main Page","content,main,focus","The main part of my site which contains what you have come to see. Lots of stuff like that and more great things. All in a sub directory."); c++; item[c]=new Array("logo.jpg","main/images/","Link Logo","link,image,logo,graphic","The logo.jpg is just a small image which you can place on your site as a link to me. It's in a second level subdirectory."); page="<html><head><title>Search Results</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>"; function search(frm) { win = window.open("","","scrollbars"); win.document.write(page); txt = frm.srchval.value.split(" "); fnd = new Array(); total=0; for (i = 0; i < item.length; i++) { fnd[i] = 0; order = new Array(0, 4, 2, 3); for (j = 0; j < order.length; j++) for (k = 0; k < txt.length; k++) if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "") fnd[i] += (j+1); } for (i = 0; i < fnd.length; i++) { n = 0; w = -1; for (j = 0;j < fnd.length; j++) if (fnd[j] > n) { n = fnd[j]; w = j; }; if (w > -1) total += show(w, win, n); fnd[w] = 0; } win.document.write("</table><br>Total found: "+total+"<br></body></html>"); win.document.close(); } function show(which,wind,num) { link = item[which][1] + item[which][0]; line = "<tr><td><a href='"+link+"'>"+item[which][2]+"</a> Sco "+num+"<br>"; line += item[which][4] + "<br>"+link+"</td></tr>"; wind.document.write(line); return 1; } // End --> </script> __________________________________________ Once again thanks guys, it's appreciated !! hello i'm building a search engine and one of the options i'm implementing is this: the user is able to control the scale of the thumbnail, small, medium and large the problem is that when i have 1000 pictures inside a div when i hit resize i get like a 5 sec delay for them to resize here is the javascript code: Code: Code: var factor; function fillImg(imgPath, imgElement){ imageObj = new Image(32,32); imageObj.src = imgPath; if(imgElement.src != imgPath ){ imgElement.src = imgPath; } } function errHandler(err){ alert("Error occured!"); } function resizeImgList(scale){ if(scale == "s"){ factor = 50; }else if(scale == "m"){ factor = 100; }else{ factor = 150; } var lists = document.getElementById("rs_ls").getElementsByTagName("li"); for(var li_index = 0; li_index < lists.length; li_index++){ var canvas = lists[li_index].getElementsByTagName("span"); for(var c_index = 0; c_index < canvas.length; c_index++){ var link = canvas[c_index].getElementsByTagName("a"); for(var a_index = 0; a_index < link.length; a_index++){ var image = link[a_index].getElementsByTagName("img"); for(var i_index = 0; i_index < image.length; i_index++){ var w = $(image[i_index]).attr("width"); var h = $(image[i_index]).attr("height"); var results = resizeItem(w,h,factor,factor); var w = results[0]; var h = results[1]; var m = results[2]; $(image[i_index]).attr("width",w); $(image[i_index]).attr("height",h); $(image[i_index]).attr("style","width:"+w+"px;height:"+h+"px;"); } wa = w+12; ha = h+12; $(link[a_index]).attr("style","width:"+wa+"px;height:"+ha+"px;"); } wc = w+12; hc = h+12; $(canvas[c_index]).attr("style","width:"+wc+"px;height:"+hc+"px;margin-left:"+m+"px;margin-right:"+m+"px;"); } wli = w + 12 + m * 2; hli = h + 12; $(lists[li_index]).attr("style","width:"+wli+"px;height:"+hli+"px;"); } } function resizeItem(eWidth, eHeight, tWidth, tHeight) { percentage = (tHeight / eHeight); newHeight = parseInt(eHeight * percentage); newWidth = parseInt(eWidth * percentage); if (newWidth > tWidth) { percentage = (tWidth / newWidth); newHeight = parseInt(newHeight * percentage); newWidth = parseInt(newWidth * percentage); } margin = (tWidth - newWidth + 12) / 2; results = [newWidth, newHeight, margin]; return results; } each result set of 50 images has this structu HTML Code: Code: <span> <ul> <li>...</li> <li>...</li> <li>...</li> <li>...</li> . . . <li>...</li> <!-- 50 <li> --> </ul> </span> so 50 results are contained inside a span each <li> has this structure inside: HTML Code: Code: <li> <span> <a href...> <img> </a> </span> </li> I altered the resizeImgList function with 1 for loop but even then it didnt seem to improve. i was thinking that i could resize only the results the user is currently seeing inside the div, the current <span> of results but i'm anaware of how to accomplish this please if anyone has any idea I would be gratefull. Thank you. Peter. PS. results (spans) are fetched via AJAX on scrolldown inside the a div (which is the result container). I HAVE CHANGED THE LOCATION
Hello all ~ It's been a long time since I've been on here, but I am trying to insert a header into my pages at http://www.dreamsonthefly.com the header being "Guided Fly Fishing on the Owyhee & Grande Ronde Rivers". I am not finding any .css on the page so I am hoping I can place in where it sits now but using the JS below and getting more space so the drop down menus don't interfere with the h1. I use Homestead and found when I was working with the JS Homestead put's their own code in as needed for their site. I am not well versed in all of this but I do understand what I need just not certain how to do it. I sure hope this all makes sense and appreciate the help. Code: <div align="center"> <img src="headerforflybooklarger.jpg" alt="Fly fishing for Steelhead, Brown Trout & Smallmouth Bass" width="1020" height="126" hspace="0"/> </div> <div align="center"> <script type="text/javascript" language="JavaScript1.2"> <!-- stm_bm(["menu3374",430,"","blank.gif",0,"","",1,2,2,2,1000,1,1,1,"","100%",83886335],this); stm_bp("p0",[0,4,0,0,15,3,0,7,100,"progid:DXImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.10)",-2,"progid:DXImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.10)",-2,100,0,0,"#000000","transparent","",0,0,0,"#000000"]); stm_ai("p0i0",[0,"Home","","",-1,-1,0,"http://www.dreamsonthefly.com/index.html","_self","","","","",0,0,0,"","",0,0,0,1,1,"#A87F09",1,"#A87F09",1,"","",0,0,0,0,"#A87F09","#000000","#000000","#000000"," bold 12pt Garamond"," bold 12pt Garamond",0,0],10,0); stm_aix("p0i1","p0i0",[0,"The Fish","","",-1,-1,0,"http://www.dreamsonthefly.com/thefish.html"],10,0); stm_aix("p0i2","p0i0",[0,"Destinations","","",-1,-1,0,"http://www.dreamsonthefly.com/destinations.html","_self","","","","",0,0,0,"arrow_r.gif","arrow_r.gif",7,7],10,0); stm_bp("p1",[1,4,0,-1,4,3,0,0,100,"progid:DXImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.41)",-2,"progid:DXImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.41)",-2,69,2,8,"#A87F09","",0,1,1,"#000000"]); stm_aix("p1i0","p0i0",[0,"Owyhee Trout","","",-1,-1,0,"http://www.dreamsonthefly.com/owyhee.html","_self","","","","",0,0,0,"","",0,0,0,1,1,"#A87F09",1,"#A87F09",1,"","",0,0,1,1],10,0); stm_aix("p1i0","p0i0",[0,"Grande Ronde","","",-1,-1,0,"http://www.dreamsonthefly.com/granderonde.html","_self","","","","",0,0,0,"","",0,0,0,1,1,"#A87F09",1,"#A87F09",1,"","",0,0,1,1],10,0); stm_aix("p1i1","p1i0",[0,"Owyhee Bass","","",-1,-1,0,"http://www.dreamsonthefly.com/ofloat.html"],10,0); stm_ep(); stm_aix("p0i3","p0i2",[0,"Guides","","",-1,-1,0,"http://www.dreamsonthefly.com/Newguides.html"],10,0); stm_bpx("p2","p1",[]); stm_aix("p2i0","p1i0",[0,"Dave Tucker","","",-1,-1,0,"http://www.dreamsonthefly.com/dtguide.html"],10,0); stm_aix("p2i1","p1i0",[0,"Rhonda Price","","",-1,-1,0,"http://www.dreamsonthefly.com/rkpguide.html"],10,0); stm_aix("p2i2","p1i0",[0,"Our Guides","","",-1,-1,0,"http://www.dreamsonthefly.com/guidesbios.html"],10,0); stm_ep(); stm_aix("p0i4","p0i0",[0,"Rates","","",-1,-1,0,"http://www.dreamsonthefly.com/newlodging.html","_self","","","","",0,0,0,"","",0,0,0,1,1,"#A87F09",1,"#A87F09",1,"","",0,0,0,0,"#A87F09","#000000","#000000","#000000","bold 12pt Garamond","bold 12pt Garamond",0,0],10,0); stm_aix("p0i5","p0i2",[0,"Flies","","",-1,-1,0,"http://www.dreamsonthefly.com/allflyinfo.html"],10,0); stm_bpx("p3","p1",[]); stm_aix("p3i0","p1i0",[0,"Steelhead Flies","","",-1,-1,0,"http://www.dreamsonthefly.com/steelheadflies.html"],10,0); stm_aix("p3i1","p1i0",[0,"Trout Flies","","",-1,-1,0,"http://www.dreamsonthefly.com/troutflies.html"],10,0); stm_aix("p3i2","p1i0",[0,"Atlantic Salmon Flies","","",-1,-1,0,"http://www.dreamsonthefly.com/atlanticsalmonflies.html"],10,0); stm_ep(); stm_aix("p0i6","p0i4",[0,"Photos","","",-1,-1,0,"http://www.dreamsonthefly.com/photogallery.html"],10,0); stm_aix("p0i7","p0i2",[0,"Contact Us","","",-1,-1,0,"http://www.dreamsonthefly.com/Contact.html"],10,0); stm_bpx("p4","p1",[]); stm_aix("p4i0","p1i0",[0,"Airline Reservations","","",-1,-1,0,"http://www.travelstoremaker.com/cgit/porch?agentid=dreamsonthefly"],10,0); stm_ep(); stm_aix("p0i8","p0i2",[0,"Links","","",-1,-1,0,"http://www.dreamsonthefly.com/links.html"],10,0); stm_bpx("p5","p1",[]); stm_aix("p5i0","p1i0",[0,"Education","","",-1,-1,0,"http://www.dreamsonthefly.com/education.html"],10,0); stm_aix("p5i1","p1i0",[0,"Resources","","",-1,-1,0,"http://www.dreamsonthefly.com/resources.html"],10,0); stm_ep(); stm_aix("p0i9","p0i0",[0,"Blog","","",-1,-1,0,"http://www.dreamsonthefly.com/blog.html","_self","","","","",0,0,0,"","",0,0,0,1,1,"#A87F09",1,"#A87F09",1,"","",0,0,0,0,"#A87F09","#000000","#000000","#000000","bold 12pt Garamond","bold 12pt Garamond",0,0],10,0); stm_ep(); stm_aix("p0i9","p0i0",[0,"Book Trip ","","",-1,-1,0,"http://www.theflybook.com/Default.aspx?shop=108e506d-f6f6-4356-8e19-1e682ece3bf1","_self","","","","",0,0,0,"","",0,0,0,1,1,"#A87F09",1,"#A87F09",1,"","",0,0,0,0,"#A87F09","#000000","#000000","#000000","bold 12pt Garamond","bold 12pt Garamond",0,0],10,0); ; ; stm_ep(); stm_ep(); stm_em(); //--> </script> </div> Hi all! I am trying to implement the "Freeze pane" feature in javascript as it is in excel. I am almost there but am not able to get one last thing. The row header freezing is achieved first column freezing is also achieved. However, the top left column cell (which is supposed to stay frozed during both horizontal and vertical scroll) is not frozen. Prompt help is highly appreciated! Please find the html file and the js file being used. Thanks a bunch! Ree I would like to somehow get both of these identical slideshow scripts working at the same time. Any help would be much appreciated! Code: <!-- dress --> <div class= dress> <div style="position:absolute; background-color:transparent; border-color: #000000; border:0px solid ; top: 443px; left: 346px; width:397px; height:255px;"> <script language="JavaScript1.2"> var variableslide=new Array() //variableslide[x]=["", "", ""] variableslide[0]=['dress/1.png', '', ''] variableslide[1]=['dress/2.png', '', ''] variableslide[2]=['dress/3.png', '', ''] //configure the below 3 variables to set the dimension/background color of the slideshow var slidewidth='395px' //set to width of LARGEST image in your slideshow var slideheight='255px' //set to height of LARGEST iamge in your slideshow, plus any text description var slidebgcolor='transparent' //configure the below variable to determine the delay between image rotations (in miliseconds) var slidedelay=200 ////Do not edit pass this line//////////////// var ie=document.all var dom=document.getElementById for (i=0;i<variableslide.length;i++){ var cacheimage=new Image() cacheimage.src=variableslide[i][0] } var currentslide=0 function rotateimages(){ contentcontainer='<center>' if (variableslide[currentslide][1]!="") contentcontainer+='<a href="'+variableslide[currentslide][1]+'">' contentcontainer+='<img src="'+variableslide[currentslide][0]+'" border="0" vspace="3">' if (variableslide[currentslide][1]!="") contentcontainer+='</a>' contentcontainer+='</center>' if (variableslide[currentslide][2]!="") contentcontainer+=variableslide[currentslide][2] if (document.layers){ crossrotateobj.document.write(contentcontainer) crossrotateobj.document.close() } else if (ie||dom) crossrotateobj.innerHTML=contentcontainer if (currentslide==variableslide.length-1) currentslide=0 else currentslide++ setTimeout("rotateimages()",slidedelay) } if (ie||dom) document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>') function start_slider(){ crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub if (document.layers) document.slidensmain.visibility="show" rotateimages() } if (ie||dom) start_slider() else if (document.layers) window.onload=start_slider </script> </div> <!-- end dress --> <!-- hair --> <div class="hair"> <div style="position:absolute; background-color:transparent; border: 0px solid; border-color: #000000; left:436px; top:105px; width:227px; height:227px;"> <script language="JavaScript1.2"> var variableslide=new Array() //variableslide[x]=["", "", ""] variableslide[0]=['hair/1.png', '', ''] variableslide[1]=['hair/2.png', '', ''] variableslide[2]=['hair/3.png', '', ''] //configure the below 3 variables to set the dimension/background color of the slideshow var slidewidth='227px' //set to width of LARGEST image in your slideshow var slideheight='227px' //set to height of LARGEST iamge in your slideshow, plus any text description var slidebgcolor='transparent' //configure the below variable to determine the delay between image rotations (in miliseconds) var slidedelay=100 ////Do not edit pass this line//////////////// var ie=document.all var dom=document.getElementById for (i=0;i<variableslide.length;i++){ var cacheimage=new Image() cacheimage.src=variableslide[i][0] } var currentslide=0 function rotateimages(){ contentcontainer='<center>' if (variableslide[currentslide][1]!="") contentcontainer+='<a href="'+variableslide[currentslide][1]+'">' contentcontainer+='<img src="'+variableslide[currentslide][0]+'" border="0" vspace="3">' if (variableslide[currentslide][1]!="") contentcontainer+='</a>' contentcontainer+='</center>' if (variableslide[currentslide][2]!="") contentcontainer+=variableslide[currentslide][2] if (document.layers){ crossrotateobj.document.write(contentcontainer) crossrotateobj.document.close() } else if (ie||dom) crossrotateobj.innerHTML=contentcontainer if (currentslide==variableslide.length-1) currentslide=0 else currentslide++ setTimeout("rotateimages()",slidedelay) } if (ie||dom) document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>') function start_slider(){ crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub if (document.layers) document.slidensmain.visibility="show" rotateimages() } if (ie||dom) start_slider() else if (document.layers) window.onload=start_slider </script> </div> <!-- end hair --> Hi, I need to change the background and the header of a website on which i display ads (by an adserver) It works with this code : <script type="text/javascript"> parent.document.getElementsByTagName("body")[0].style.backgroundImage="url(http://example.jpg)"; parent.document.getElementsByTagName("body")[0].style.backgroundPosition="center 0"; parent.document.getElementsByTagName("body")[0].style.backgroundRepeat="no-repeat"; parent.document.getElementsByTagName("body")[0].style.backgroundColor = "#85bc21"; parent.document.getElementById("header").style.backgroundImage="url(http://example.jpg)"; </script> But i need those elements become clickable. Have you any solutions ? Thanks a lot. Sorry for my %"*!?& english Benoo A full description of the problem, all the code and the test is also posted on: http://happinesshabitS.com/testroto4.htm I am trying to install a rotating banner on http://HappinessHabit.com How do I position the banner so it is NOT at the upper left hand corner of the page? I have tried wrapping it in <div> tags but that hasn't worked. I can get it rotating fine on the test page, but cannot place the rotating banner where I need it - see: http://happinesshabitS.com The code I placed on the test page is: Code: <script type="text/javascript" src="jshdrotate-1.js" ></script> </head> and Code: </head> <body onLoad="preloadImgs();randomImages();"> <img src="rotoimage1/ri-image-01.jpg" name="rotator" width="800" height="135" border="0" id="rotator"></a> Can I place this right above the </body> tag? The code I placed in a separate (jshdrotate-1.js) file is on http://happinesshabits.com/javahelp.pdf and below: Code: function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } // Comma separated list of images to rotate var imgs = new Array('rotoimage1/ri-image-01.jpg','rotoimage1/ri-image-02.jpg','rotoimage1/ri-image-03.jpg','rotoimage1/ri-image-04.jpg','rotoimage1/ri-image-05.jpg', 'rotoimage1/ri-image-06.jpg', 'rotoimage1/ri-image-07.jpg', 'rotoimage1/ri-image-08.jpg','rotoimage1/ri-image-09.jpg', 'rotoimage1/ri-image-10.jpg','rotoimage1/ri-image-11.jpg', 'rotoimage1/ri-image-12.jpg'); // delay in milliseconds between image swaps 1000 = 1 second var delay = 6000; var counter = 0; function preloadImgs(){ for(var i=0;i<imgs.length;i++){ MM_preloadImages(imgs[i]); } } function randomImages(){ if(counter == (imgs.length)){ counter = 0; } MM_swapImage('rotator', '', imgs[counter++]); setTimeout('randomImages()', delay); } Many thanks for your help ! I am really in the dark about this. I'd asked this question before but didn't get any replies. Did I post and describe what I am trying to do and the problem correctly? Many thanks! |