JavaScript - Random Order - Javascript - Photoslide 2 - Gk News Image Vi
Using the Photoslide, GK News Image VI, as seen here tools.gavick.com/demo/ni6, however its in ID order, listed.
I would like to change the order of ID to Random Order. Can you please help, what code would need changing. thank you its javascript. code below: Fx.Height = Fx.Style.extend({initialize: function(el, options){$(el).setStyle('overflow', 'hidden');this.parent(el, 'height', options);},toggle: function(){var style = this.element.getStyle('height').toInt();return (style > 0) ? this.start(style, 0) : this.start(0, this.element.scrollHeight);},show: function(){return this.set(this.element.scrollHeight);}});Fx.Opacity = Fx.Style.extend({initialize: function(el, options){this.now = 1;this.parent(el, 'opacity', options);},toggle: function(){return (this.now > 0) ? this.start(1, 0) : this.start(0, 1);},show: function(){return this.set(1);}}); // window.addEvent("load",function(){ document.getElementsBySelector(".gk_ni_6_wrapper").each(function(el){ // generowanie rdzenia var mainwrap = el; var elID = el.getProperty("id"); var $G = $Gavick[elID]; var wrap = $(elID); var mouseIsOver = false; var scrollValue = 0; // var addWidth = $E("div",el).getStyle("padding-left").toInt() + $E("div",el).getStyle("padding-right").toInt() + $E("div",el).getStyle("margin-right").toInt(); // el.setStyle("width",(el.getStyle("width").toInt() + addWidth) + "px"); // $G["actual_slide"] = -1; $G["actual_anim"] = false; $G["actual_anim_p"] = false; // var slides = []; var contents = []; var pasek = false; // if(window.ie && $E(".gk_ni_6_text_bg", wrap)) $E(".gk_ni_6_text_bg",wrap).setOpacity($G["opacity"].toFloat()); // wrap.getElementsBySelector(".gk_ni_6_slide").each(function(elmt,i){slides[i] = elmt;}); slides.each(function(el,i){if(i != 0) el.setOpacity(0);}); // if($E(".gk_ni_6_text_bg", wrap)){ var text_block = $E(".gk_ni_6_text_bg",wrap); $ES(".gk_ni_6_news_text",wrap).each(function(el,i){contents[i] = el.innerHTML;}); } // animacje var amount_c = contents.length-1; if($E(".gk_ni_6_text", wrap)) $E(".gk_ni_6_text",wrap).innerHTML = contents[0]; // var loadedImages = ($E('.gk_ni_6_preloader', wrap)) ? false : true; // if($E('.gk_ni_6_preloader', wrap)){ var imagesToLoad = []; // $ES('.gk_ni_6_slide',wrap).each(function(el,i){ var newImg = new Element('img',{ "src" : el.innerHTML, "alt" : el.getProperty('title') }); imagesToLoad.push(newImg); el.innerHTML = ''; newImg.injectInside(el); }); // var timerrr = (function(){ var process = 0; imagesToLoad.each(function(el,i){ if(el.complete) process++; }); // if(process == imagesToLoad.length){ $clear(timerrr); loadedImages = process; (function(){new Fx.Opacity($E('.gk_ni_6_preloader', wrap)).start(1,0);}).delay(400); } }).periodical(200); } var timerrr2 = (function(){ if(loadedImages){ $clear(timerrr2); // ---------- var NI2 = new news_image_6(); // $ES(".gk_ni_6_tab",mainwrap).each(function(elx,index){ var hover = $E(".gk_ni_6_hover" , elx); var opacity_anim = new Fx.Opacity(hover, {duration: 250, wait: false}); // elx.addEvent("mouseenter",function(){ hover.setStyle("display", "block"); opacity_anim.start(1); }); // elx.addEvent("mouseleave",function(){ opacity_anim.start(0); (function(){hover.setStyle("display", "none");}).delay(250); }); // elx.addEvent("click", function(){ if(!$G["actual_anim_p"]){ $E(".gk_ni_6_tab_active",mainwrap).setProperty("class","gk_ni_6_tab"); elx.setProperty("class","gk_ni_6_tab_active"); } // NI2.image_anim(elID,mainwrap,wrap,slides,index,contents,$G,false); }); }); $E(".gk_ni_6_tab",mainwrap).setProperty("class","gk_ni_6_tab_active"); NI2.image_anim(elID,mainwrap,wrap,slides,0,contents,$G,($G["autoanim"]==1)); /** Slider implementation **/ if($E('.gk_ni_6_tabsbar_slider',mainwrap)){ var $offset = $E(".gk_ni_6_tab",mainwrap).getStyle("height").toInt() + $E(".gk_ni_6_tab",mainwrap).getStyle("margin-bottom").toInt(); var scrollArea = $E('.gk_ni_6_tabsbar_wrap', mainwrap); var scrollableArea = $E('.gk_ni_6_tabsbar', mainwrap); var scrollAreaH = scrollArea.getSize().size.y; var scrollableAreaH = scrollableArea.getSize().size.y; var scroller_up = new Fx.Scroll(scrollArea, {duration: 250, wait: true, transition: Fx.Transitions.Circ.easeIn, onComplete: function(){scrollValue -= $offset;}}); var scroller_down = new Fx.Scroll(scrollArea, {duration: 250, wait: true, transition: Fx.Transitions.Circ.easeIn, onComplete: function(){scrollValue += $offset;}}); // $E('.gk_ni_6_tabsbar_up', mainwrap).addEvent("click",function(){ if(scrollValue > 0) { scroller_up.scrollTo(0, scrollValue-$offset);} }); // $E('.gk_ni_6_tabsbar_down', mainwrap).addEvent("click",function(){ if((scrollValue < (scrollableAreaH-scrollAreaH))) { scroller_down.scrollTo(0, scrollValue+$offset); } }); } }}).periodical(250); }); }); // var news_image_6 = new Class({ // text_anim : function(wrap,contents,$G){ var txt = $E(".gk_ni_6_text",wrap); if(txt){ if($G["anim_type_t"] == 0){ new Fx.Opacity(txt,{duration: $G["anim_speed"]/2}).start(1,0); (function(){ new Fx.Opacity(txt,{duration: $G["anim_speed"]/2}).start(0,1);txt.innerHTML = contents[$G["actual_slide"]]; }).delay($G["anim_speed"]); } else txt.innerHTML = contents[$G["actual_slide"]]; } }, // image_anim : function(elID,mainwrap,wrap,slides,n,contents,$G,play){ var max = slides.length-1; var links = $ES('.gk_ni_6_news_link', mainwrap); var readon = $E('.gk_ni_6_readmore_button a', mainwrap); if(!$G["actual_anim_p"] && n != $G["actual_slide"]){ $G["actual_anim_p"] = true; if(readon) readon.setProperty("href", links[n].innerHTML); var actual_slide = $G["actual_slide"]; $G["actual_slide"] = n; slides[n].setStyle("z-index",max+1); if(actual_slide != -1) new Fx.Opacity(slides[actual_slide],{duration: $G["anim_speed"]}).start(1,0); new Fx.Opacity(slides[n],{duration: $G["anim_speed"]}).start(0,1); this.text_anim(wrap,contents,$G); switch($G["anim_type"]){ case 0: break; case 1: new Fx.Style(slides[n],'margin-top',{duration: $G["anim_speed"]}).start((-1)*slides[n].getSize().size.y,0);break; case 2: new Fx.Style(slides[n],'margin-left',{duration: $G["anim_speed"]}).start((-1)*slides[n].getSize().size.x,0);break; case 3: new Fx.Style(slides[n],'margin-top',{duration: $G["anim_speed"]}).start(slides[n].getSize().size.y,0);break; case 4: new Fx.Style(slides[n],'margin-left',{duration: $G["anim_speed"]}).start(slides[n].getSize().size.x,0);break; } if(play){ $E(".gk_ni_6_tab_active",mainwrap).setProperty("class","gk_ni_6_tab"); $ES(".gk_ni_6_tab",mainwrap)[n].setProperty("class","gk_ni_6_tab_active"); } (function(){slides[n].setStyle("z-index",n);}).delay($G["anim_speed"]); (function(){$G["actual_anim_p"] = false;}).delay($G["anim_speed"]); var $this = this; if(!play) this.image_pause($G); if((play || $G["autoanim"] == 1) && ($G["actual_anim"] == false)){ $G["actual_anim"] = (function(){ n = (n < max) ? n+1 : 0; $this.image_anim(elID,mainwrap,wrap,slides,n,contents,$G,true); }).periodical($G["anim_speed"] * 2 + $G["anim_interval"]); } } }, // image_pause : function($G) { $clear($G["actual_anim"]); $G["actual_anim"] = false; } }); Similar TutorialsI have a form that used php to load a random image but now i would like to use javascript instead and am sure I nearly have it. I need to have a random number between 0 -5. Here is my code Code: <script type='text/javascript'> var random = Math.floor( Math.rand() * 6); document.write("<img src='images/'"+random+"'.jpg' alt='random image' /><input name='image' type='hidden' value='"+random+"' />") </script> Ok got a random image display and have tried to make it so once the image is displayed it is taken out of the array so it can not be viewed again untill there are no more elements in the array, problem is, it doesn't work. Have been told about shuffle, but not very keen on that. Can someone shed some light. 4 images, with accompaning links to be displayed 4 times, all unique. Code: Code: <script language="JavaScript"> function random_imglink(){ var myimages=new Array() myimages[0]="http://ads.factorymedia.com/www/images/fbm_oct10_300x80.gif" myimages[1]="http://ads.factorymedia.com/www/images/rbbyd_web_banner_300x80_animated.gif" myimages[2]="http://ads.factorymedia.com/www/images/2010_vex_300x80.jpg" myimages[3]="http://ads.factorymedia.com/www/images/image_3.gif" var imagelinks=new Array() imagelinks[0]="http://www.4downdistribution.com/" imagelinks[1]="http://www.redbull.co.uk/cs/Satellite/en_UK/Event/Red-Bull-Backyard-Digger-021242831811513" imagelinks[2]="http://verdebmx.com/" imagelinks[3]="http://www.zealbmx.com/" var count; for(count=0; count<myimages.length; count++) { if (myimages.length>0) { var ry=Math.floor(Math.random()*myimages.length) document.write('<div class="feed2"><a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" height=64px width=240px border=0></a></div>') if (ry>0 && ry<myimages.length-1) { myimages=concat(myimages. (0,ry-1),myimages.slice(ry+1,myimages.length-1)); imagelinks=concat(imagelinks.slice(0,ry-1),imagelinks.slice(ry+1,imagelinks.length-1)); } if (ry==0) { myimages=myimages.slice(1,myimages.length-1); imagelinks=imagelinks.slice(1,imagelinks.length-1); } if (ry==myimages.length-1) { myimages=myimages.slice(0,ry-1); imagelinks=imagelinks.slice(0,ry-1); } } } } </script> <script language="JavaScript"> random_imglink(); </script> an alternative way that also didn't work Code: function random_imglink(){ var myimages=new Array(); myimages[0]="http://ads.factorymedia.com/www/images/fbm_oct10_300x80.gif"; myimages[1]="http://ads.factorymedia.com/www/images/rbbyd_web_banner_300x80_animated.gif"; myimages[2]="http://ads.factorymedia.com/www/images/2010_vex_300x80.jpg"; myimages[3]="http://ads.factorymedia.com/www/images/image_3.gif"; var imagelinks=new Array(); imagelinks[0]="http://www.4downdistribution.com/"; imagelinks[1]="http://www.redbull.co.uk/cs/Satellite/en_UK/Event/Red-Bull-Backyard-Digger-021242831811513"; imagelinks[2]="http://verdebmx.com/"; imagelinks[3]="http://www.zealbmx.com/"; var indexes = [0, 1, 2, 3]; index.sort(function (){ reutrn 0.5 - Math.random(); }); for(var count=0; count < index.length; count++) { var ry = indexes[count]; document.write('<div class="feed2"><a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" height=64px width=240px border=0></a></div>'); } } So I found this script and i give all props to the author but can anyone help me to add text to the random images. Also i need a button that will generate the random images/text not when you refresh the page but when your press the button and to not display any image/text till the button is pressed? Thanks in advance. [CODE] <script language="Javascript"> var currentdate = 0 var core = 0 function StringArray (n) { this.length = n; for (var i =1; i <= n; i++) { this[i] = ' ' } } image = new StringArray(10) image[0] = 'images' image[1] = 'images' image[2] = 'images' image[3] = 'images' image[4] = 'images' image[5] = 'images' image[6] = 'images' image[7] = 'images' image[8] = 'images' image[9] = 'images' var ran = 60/image.length function ranimage() { currentdate = new Date() core = currentdate.getSeconds() core = Math.floor(core/ran) return(image[core]) } document.write("<img src='" +ranimage()+ "'>") </script> <form> <p><input type="button" name="B1" value="Switch It Up" onclick="ranimage()"></p> </form> [CODE] Hi I have some Javascript on my website http://www.restoreanddesign.co.uk The top bar has 4 images on a random cycle on load up/ refresh. Im trying to validate the xhtml, but it is coming up with errors. I dont understand javascript enough to be able to fix this. Anyone know what needs to be done to validate this javascript. i have bolded/coloured the lines i think is causing the problems -------------------------------------------------------------------- Code: <script type="text/javascript" language="JavaScript"> // JavaScript Document var imagenumber = 4 ; var randomnumber = Math.random() ; var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ; images = new Array images[1] = "images/newtopbar.jpg" images[2] = "images/newtopbar2.jpg" images[3] = "images/newtopbar3.jpg" images[4] = "images/newtopbar4.jpg" var image = images[rand1] 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_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_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];} } </script> Hey. Right, so I've just paid a guy to design and code just the layout files, not the content, panels, etc. I've coded a panel which will allow my staff to post news articles which will be displayed on the main website. Adding, Editing, Deleting news and all the rest works 100% fine however it appears that the designer has coded the news displayer into a .JS (javascript) file. The news displayer looks like this: ^ This is what it looks like when you hover over one of the 3 news items shown on the right. The image (blue box) changes depending on which news item you hover over This is what it looks like when you then hover over the image for that article: The HTML: Code: <div class="left"> <div id="headline_image_box"> <a href="#"> <img name="imagename" src="_images/_headlines/1.png" alt="Description" /> <span class="desc" id="description"> <script type="text/javascript">writetext(firsttext)</script> </span> </a> </div> </div> <div class="middle"> <a href="#"> <div class="headline" onMouseover="document.imagename.src=image1.src, writeDesc(desc1)" onMouseout="document.imagename.src=image1.src"> <strong>So far so good for Wiggins</strong><br /> Team Sky's Bradley Wiggins says he's going from strength to strength at the Vuelta a Espana. </div> </a> <a href="#"> <div class="headline" onMouseover="document.imagename.src=image2.src, writeDesc(desc2)" onMouseout="document.imagename.src=image2.src"> <strong>Spurs locked in Cahill talks</strong><br /> Bolton Wanderers and Tottenham Hotspur are locked in talks regarding a deal for Gary Cahill. </div> </a> <a href="#"> <div class="headline" onMouseover="document.imagename.src=image3.src, writeDesc(desc3)" onMouseout="document.imagename.src=image3.src"> <strong>Santon set for medical</strong><br /> Italy international Davide Santon has arrived in England to finalise a move to Newcastle United. </div> </a> </div> The Javascript File: Code: if (document.images) { image1 = new Image image2 = new Image image3 = new Image image1.src = "_images/_headlines/1.png" image2.src = "_images/_headlines/2.png" image3.src = "_images/_headlines/3.png" } var desc1='<strong>13th AUG</strong>Description 1' var desc2='<strong>12th AUG</strong>Description 2' var desc3='<strong>11th AUG</strong>Description 3' function writeDesc(what){ document.getElementById('description').innerHTML=''+what+''; } Database Structu Code: CREATE TABLE IF NOT EXISTS `news` ( `id` int(2) NOT NULL AUTO_INCREMENT, `title` varchar(100) NOT NULL, `author` varchar(100) NOT NULL, `category` varchar(100) NOT NULL, `article` varchar(50000) NOT NULL, `image` varchar(500) NOT NULL, `j` varchar(5) NOT NULL, `M` varchar(5) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; j = Date with letters on end. Eg. 4TH M = 3 character form of month. ALL details submit into database fine, that is not my issue. My issue is that I want to get the latest three articles from the database and echo the values from the database into the javascript however this stuffs up the script completely. I'm not very experienced with using Javascript & PHP together but I noticed something was wrong when I echoed it into the script. Anyone with any ideas/suggestions it'd be very helpful and appreciated! I'd prefer not to have to change to a completely new script, so if you have a way to integrate the MySQL information into the Javascript it'd be great! I started using the Google News Web Element on my website. The website for Google News Web Element is: http://www.google.com/webelements/#!/news I want the links to open in a new window, which cannot be done with the iframe version. Their website only allows me to generate an iframe. I was told that this can be done by using the javascript version, but I have not been able to figure it out. This is their link to the documentation: http://code.google.com/apis/newssearch/newsshow/ I know very little about javascript, and have been trying to get it to work but have been unsuccessful. I want to use the Medium Rectangle size and I want the only topic to be "Swainsboro". The only modification that I want to make is for the links to open in a new window. If anyone can help me do this, it would be appreciated. This is the iframe data that was generated by the wizard: Code: <iframe frameborder=0 marginwidth=0 marginheight=0 border=0 style="border:0;margin:0;width:300px;height:250px;" src="http://www.google.com/uds/modules/elements/newsshow/iframe.html?rsz=large&format=300x250&ned=us&hl=en&q=Swainsboro&element=true" scrolling="no" allowtransparency="true"></iframe> if you take a look at this site here you can see that it no longer scrolls or even displays content, but here it does. I'll bet there's a quick fix here, but not sure what it is. Any ideas?
Here's what I usually use and have been using for years and it works great, just not for this particular purpose. I don't have a clue when it comes to javascript. Code: <noscript><img src="no_script_quote.gif" width="406" height="94"/></noscript><script language="javascript"> var delay=6000 var curindex=0 var images=new Array() images[0]="quote1.gif" images[1]="quote2.gif" images[2]="quote3.gif" images[3]="quote4.gif" images[4]="quote5.gif" var preload=new Array() for (n=0;n<images.length;n++) { preload[n]=new Image() preload[n].src=images[n] } document.write('<img name="defaultimage" src="'+images[Math.floor(Math.random()*(images.length))]+'">') function rotateimage() { if (curindex==(tempindex=Math.floor(Math.random()*(images.length)))){ curindex=curindex==0? 1 : curindex-1 } else curindex=tempindex document.images.defaultimage.src=images[curindex] } setInterval("rotateimage()",delay) </script> But, now I want to be able to set a default picture to be shown first and have the random pics appear next. I also don't want the default pic to show up again in the random array. So basically, every time the page was first visited, or refreshed it would show the default picture then move into the random pics. Is there anyway to modify the code that I'm using to accomplish this? Or... Any help would be appreciated. Thanks, Dell Hey folks.. Hope you can help, I'm completely new to this and have no knowledge at all when it comes to javascript. Have been using this script on my site for a while. Is there anyway I can add a URL link to the images that are in my selector? When clicked would go to that page on my website. Thanks in advance of any help Nat <script language="JavaScript"> /* Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com) For this script and more, visit http://www.javascriptkit.com */ var delay=10000 //set delay in miliseconds var curindex=0 var randomimages=new Array() randomimages[0]="http://www.anywebsite.com/images/splash1.jpg" randomimages[1]="http://www.anywebsite.com/images/splash2.jpg" randomimages[2]="http://www.anywebsite.com/images/splash3.jpg" randomimages[3]="http://www.anywebsite.com/images/splash4.jpg" randomimages[4]="http://www.anywebsite.com/images/splash5.jpg" var preload=new Array() for (n=0;n<randomimages.length;n++) { preload[n]=new Image() preload[n].src=randomimages[n] } document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">') function rotateimage() { if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){ curindex=curindex==0? 1 : curindex-1 } else curindex=tempindex document.images.defaultimage.src=randomimages[curindex] } setInterval("rotateimage()",delay) </script> I have a challenge I gave to myself. I want a script that asks me to put things in order. Say I want a quiz of family, order of age. I have a table with the left cell everybody's name I want a script where I click on a name and it moves over to the right hand cell, up top, then the next clicked named is put under it and so on until all the names are moved over. So far I have this, but I know there is a lot of room for improvment. any suggestions? <HTML> <HEAD> <TITLE>Put Bible books in proper order</TITLE> </head> <body> <h1>Hello World!</h1> <TABLE BORDER=5><TR><TD> <FORM NAME="BOOKS"> <script language="javascript" type="text/javascript"> alert('This is what an alert message looks like.'); FUNCTION TESTER() { ALERT('WORKS'); VAR GOOD=0; VAR BAD=0; if (BOOKS.FONE="A") { GOOD++; } ELSE { BAD++; }; ALERT("YOU HAVE INCORRECT"); } </script> <TABLE BORDER=0><TR><TD> <TABLE BORDER=1> <TR><TD><INPUT TYPE="BUTTON" VALUE="Adam" NAME="GONE" onClick="javascript:TEMP.value=this.value";> <TR><TD><INPUT TYPE="BUTTON" VALUE="Dave" NAME="GTWO" ONCLICK="javascript:TEMP.value=this.value";> <TR><TD><INPUT TYPE="BUTTON" VALUE="Kile" NAME="GTHREE" ONCLICK="javascript:TEMP.value=this.value";> <TR><TD><INPUT TYPE="BUTTON" VALUE="John" NAME="GFOUR" ONCLICK="javascript:TEMP.value=this.value;"> <TR><TD><INPUT TYPE="BUTTON" VALUE="Geroge" NAME="GTWO" ONCLICK="javascript:TEMP.value=this.value;"> </TABLE> <TD VALIGN="CENTER" ALIGN="CENTER" WIDTH=30> <INPUT TYPE="BUTTON" VALUE=" " NAME="TEMP"> <TD> <TABLE BORDER=1> <TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FONE" ONCLICK="javascript:this.value=TEMP.value;TEMP.value=' '"> <TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FTWO" ONCLICK="javascript:this.value=TEMP.value;"> <TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FTHREE" ONCLICK="javascript:this.value=TEMP.value;"> <TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FFOUR" ONCLICK="javascript:this.value=TEMP.value;"> <TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FFIVE" ONCLICK="javascript:this.value=TEMP.value;"> </TABLE> </TABLE> <INPUT TYPE="BUTTON" NAME="CHECK" onClick="JAVASCRIPT:ALERT()" VALUE="CORRECT???"> </FORM> </TABLE> </BODY> </HTML> Hello, I have to JS scripts running on a page, one is a fading slide-show acting as a header and the other is a light-box like image gallery. When I view a picture in the "light-box" mode it sits underneath the fading slide-show and I want it to be on top of everything - much like setting the z-index in css. Although I don't think this is the way to solve this. Anyway, you can check what I'm talking about here. Code: strapplicantid=document.getElementById('applicantid').value; $.get("spt.asp"+ '?id=' + strapplicantid + '&rnde='+ Math.round(Math.random() * 10000), function(data){ alert("Data Loaded: " + data); }); alert("here"); why is the alert("here") happenign before the alert dataloaded. I want to be albe to load the html into the variable data and then use that variable. How is this possible to do? Hello guys, I am a js noobie really, and am looking for something specific. I have googled for quite some time now looking for a script to randomize a list of images on refresh. For example, If I have 8 images in a line in this order 12345678, when I refresh, I would like them to go into a new random order - 84567321, or anything. What I have found are scripts to allow random new images to appear in place of a single image, which is as close as I have gotten. Does anyone know of a script that can do this, or know how to make one? I have looked everywhere, and can't seem to locate one. Any help is greatly appreciated. Problem solved thanks to Philip M. ____________________________________________________________________________________ Here is the source code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML> <HEAD> <TITLE>Order Forms</TITLE> <SCRIPT> /******************************* Form Calculations ************************************/ function calculate(fld, price) { // fld will equal pw1 or pe1 var dir = fld.name.charAt(1); // used to determine whether it is the East or West Form var num = fld.name.charAt(2); // what Item number is it var quant = fld.options[fld.selectedIndex].value; // how many of the items did the User choose var subtotal = eval(quant * price); // the eval converts a string to an Object property - in this case the value // dir = East or West & num = Item number // with this information we can post the result to appropriate Form & // to the appropriate Field on the Form eval('document.order.t' + dir + num).value = fix(subtotal); var total = 0; // this loop sums the totals for each of the Items to give us the Grand Total for that Form for (i = 1; i < 11; i++) { // does that particular Item have a "total" - in other words did the User choose this Item var itemTotal = eval('document.order.t' + dir + i).value; // total is a running sum of the Form's "subtotals" if (parseFloat(itemTotal) > 0) total += parseFloat(itemTotal); } // prior to sticking in the Grand Total into the Total Field we need to "dollarize" the number eval('document.order.total' + dir ).value = fix(total); } // a number like 6.6 should ultimately read as $6.60 and not $6.6 // a number like 6.6275 should ultimately read as $6.63 // the fix(total) function takes care of these particular problems function fix(total) { // ie, total == 6.6275 var dollars = Math.floor(total); // dollars = 6 // browsers sometimes have rounding errors - 662.75 - 600 = 62.75 var cents = (total * 100) - (dollars * 100); cents = Math.round(cents); // 63 if (cents < 10) cents = "0" + cents; // .998 will become 1.00 so we need to increment the dollar value by one if (cents == 100) dollars++; // if cents equal 0 then dollars equal total or total + 1 incase of .998 if (dollars == total || dollars == Math.floor(total) + 1) cents = "00"; total = dollars + "." + cents; // 6.63 return total; } /******* End of Form Calculations ********/ </SCRIPT> </HEAD> <BODY BGCOLOR="#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><form action="sendemail.php" method="post" name="order" id="order" onSubmit="return ValidateInput(this)"></td> <td><input type="hidden" name="Formulaire de commande site Pain et Passion" value=""></td> <td></td> <td></td> </tr> <tr> <td>Product</td> <td>Price</td> <td>Quantity</td> <td>Total</td> </tr> <tr> <td>Item 1</td> <td>1.99</td> <td><SELECT NAME="pw1" SIZE="1" ONCHANGE="calculate(this, 1.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw1" SIZE="10" VALUE></td> </tr> <tr> <td>Item2</td> <td>2.99</td> <td><SELECT NAME="pw2" SIZE="1" ONCHANGE="calculate(this, 2.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw2" SIZE="10" VALUE></td> </tr> <tr> <td>item3</td> <td>3.99</td> <td><SELECT NAME="pw3" SIZE="1" ONCHANGE="calculate(this, 3.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw3" SIZE="10" VALUE></td> </tr> <tr> <td>Item3</td> <td>1.99</td> <td><SELECT NAME="pw4" SIZE="1" ONCHANGE="calculate(this, 1.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw4" SIZE="10" VALUE></td> </tr> <tr> <td>Item4</td> <td>3.99</td> <td><SELECT NAME="pw5" SIZE="1" ONCHANGE="calculate(this, 3.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw5" SIZE="10" VALUE></td> </tr> <tr> <td>Item5</td> <td>2.99</td> <td><SELECT NAME="pw6" SIZE="1" ONCHANGE="calculate(this, 2.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw6" SIZE="10" VALUE></td> </tr> <tr> <td>Item6 </td> <td>4.99</td> <td><SELECT NAME="pw7" SIZE="1" ONCHANGE="calculate(this, 4.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw7" SIZE="10" VALUE></td> </tr> <tr> <td>Item7</td> <td>5.99</td> <td><SELECT NAME="pw8" SIZE="1" ONCHANGE="calculate(this, 5.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw8" SIZE="10" VALUE></td> </tr> <tr> <td>Item8</td> <td>1.99</td> <td><SELECT NAME="pw9" SIZE="1" ONCHANGE="calculate(this, 1.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw9" SIZE="10" VALUE></td> </tr> <tr> <td>Item9 (not working)</td> <td>5.99</td> <td><SELECT NAME="pw10" SIZE="1" ONCHANGE="calculate(this, 5.99)"> <OPTION VALUE="0">0</OPTION> <OPTION VALUE="1">1</OPTION> <OPTION VALUE="2">2</OPTION> <OPTION VALUE="3">3</OPTION> <OPTION VALUE="4">4</OPTION> <OPTION VALUE="5">5</OPTION> <OPTION VALUE="6">6</OPTION> <OPTION VALUE="7">7</OPTION> <OPTION VALUE="8">8</OPTION> <OPTION VALUE="9">9</OPTION> <OPTION VALUE="10">10</OPTION> <OPTION VALUE="11">11</OPTION> <OPTION VALUE="12">12</OPTION> <OPTION VALUE="13">13</OPTION> <OPTION VALUE="14">14</OPTION> <OPTION VALUE="15">15</OPTION> <OPTION VALUE="16">16</OPTION> <OPTION VALUE="17">17</OPTION> <OPTION VALUE="18">18</OPTION> <OPTION VALUE="19">19</OPTION> <OPTION VALUE="20">20</OPTION> </SELECT></td> <td><INPUT TYPE="text" NAME="tw10" SIZE="10" VALUE></td> <tr> <td><p align="right">grand total <img src="arrow.png" width="32" height="32" border="0" alt="" align="absmiddle"></p></td> <td><input type="text" name="totalw" size="10" style="background: #87cefa;"></td> <td align="left"><input type="submit" value="SEND YOUR ORDER" style="background: #87cefa;"></td> </tr> </tr> <tr> <td>Name</td> <td><input type="text" name="name"></td> <td></td> <td></td> </tr> <tr> <td>e-mail</td> <td><input type="text" name="e-mail"></td> <td></td> <td></td> </tr> <tr> <td>Phone</td> <td><input type="text" name="phone"></td> <td></td> <td></td> </tr> </table> </FORM> </BODY> </HTML> I need to make a --very-- simple version of this game: http://javascript.internet.com/games/magic-squares.html. You need to click on the buttons until they're in order, then you win. I'm having trouble with the function that trades the places of the two buttons. So, can anyone tell me how my "swap" function should be? It needs to test if the value of the button next to the button clicked on is blank, and then if it is, the two values trade places. This way, I will hopefully end up with 9 different functions, depending on which square I'm clicking on, because the "id" of the button stays the same, it just swaps the values. It shouldn't use any arrays or anything. Thanks, I appreciate the help! Here's what I have so far: Code: <html> <head> <title>15 Puzzle</title> <script type="text/javascript"> function swap(id){ if(document.getElementById(id+1).value="") { document.getElementById(id+1).value=document.getElementById(id).value; document.getElementById(id).value=""; alert('It works!'); } } </script> </head> <p><h1 align="center">15 Puzzle</h1><p> <p align="center"><input type="button" id="scramble" value="Scramble"></p> <br> <table border="3" bordercolor="black" width="300" bgcolor="" cellpadding="50" align="center"> <tr> <td ><input type="button" id="1" value="1" onclick=" swap(this.id);"></td> <td > <input type="button" id="2" value="" onclick="swap(this.id)"></td> <td> <input type="button" id="3" value="3" onclick="swap(this.id)"> </td> <td> <input type="button" id="4" value="4" onclick="swap(this.id)"> </td> </tr> <tr> <td> <input type="button" id="5" value="5" onclick="swap(this.id)"> </td> <td> <input type="button" id="6" value="6" onclick="swap(this.id)"> </td> <td> <input type="button" id="7" value="7" onclick="swap(this.id)"> </td> <td> <input type="button" id="8" value="8" onclick="swap(this.id)"> </td> </tr> <tr> <td> <input type="button" id="9" value="9" onclick="swap(this.id)"> </td> <td> <input type="button" id="10" value="10" onclick="swap(this.id)"> </td> <td> <input type="button" id="11" value="11" onclick="swap(this.id)"> </td> <td> <input type="button" id="12" value="12" onclick="swap(this.id)"> </td> </tr> <tr> <td> <input type="button" id="13" value="13" onclick="swap(this.id)"> </td> <td> <input type="button" id="14" value="14" onclick="swap(this.id)"> </td> <td> <input type="button" id="15" value="15" onclick="swap(this.id)"> </td> <td> <input type="button" id="16" value="2" onclick="swap(this.id)"> </td> </tr> </table> </html> Hello, I am nearing completion on the modification of a Javascript/Html Order Form. The problem arises when I click on 'Submit Order' after filling in details and choosing a product. For some reason, the pop up box shows the correct product, but it shows the $ Total from the previous box in the table. Thank you all for your time in looking into this: Code: <html> <head> <title>JS Order</title> <script language="JavaScript"> <!-- Start hiding from older browsers. // This function displays the nag screen when a field hasn't been filled in. function nag(form, field, x) { ufield=field.toUpperCase(); alert("Details missed " + ufield + "!" + "\n\nPlease fill in the field and submit the form again."); form.elements[x].focus(); } // This function is used to round the tax amount to the nearest hundreths. function roundPrice(price) { // save a copy of the price in case it is an even dollar amount. var workPrice = price; // Make the price a string by adding a string 0 to the end. workPrice += "0"; // Find out where the decimal point is. var pointIndex = workPrice.indexOf(".",0); // If there is a decimal point now check to see if it needs to be rounded up. if (pointIndex >= "0") { // Set an index for the thousands digit. var thousands = pointIndex +3; // if the third number past the decimal point is greater than or // equal to 5, then we need to round up the hundredth digit. if (workPrice.charAt(thousands) >= "5") { // Turn the price into a number. workPrice=parseFloat(price); // Round up the price. workPrice=workPrice + .01; // Turn it back into a string. workPrice=workPrice + "0"; // Cut off the thousands on down. rPrice = workPrice.substring(0,thousands); } else { // We didn't need to round the price up so cut off the // thousands on down and return the price rPrice = workPrice.substring(0,thousands); } // Its an even dollar amount so just put on the .00 on the end. } else { rPrice = price + ".00"; } // Now return the rounded price. return rPrice; } // This function calculates the form. function updatePrice() { // Reset the subtotal price var addPrice = 0; // Reset the running total prices. var nowPrice = 0; // Reset the nubmer of part ordered. var partcount = 0; // Step through each element in the form. for (i = 0; i < parseInt(self.document.forms[0].elements.length); i++) { // If the form element has "qty" in the name then we need to process it. if (self.document.forms[0].elements[i].name.substring(0,3) == 'qty') { // If the item has a quantity of not 0, then we need to process it. if (self.document.forms[0].elements[i].value != 0) { // Locate the cost costIndex = i + 1; // Increment the part counter. partcount++; // Get the actual value for the quantity. nowQty = eval(self.document.forms[0].elements[i].value); // Get the cost of the item. nowPrice = eval(self.document.forms[0].elements[costIndex].value); // Calculate the extended cost (i.e., quanty * cost). nowPrice = eval(nowPrice * nowQty); // Add to the subtotal. addPrice += nowPrice; } } } // Round off the subTotal price. subTotal=roundPrice(addPrice); // Put the sub total price into the form. self.document.forms[0].subtot.value = subTotal; // Figure the tax. tax = parseFloat(self.document.forms[0].taxrate.value * addPrice); // Round off the tax price. totalTax = roundPrice(tax); // Put the total tax into the form. self.document.forms[0].totaltax.value = totalTax; // Start figuring the total including tax. // Turn the price string into a number. subPrice = parseFloat(addPrice); // Turn the tax string into a number. addTax = parseFloat(totalTax); // Add the tax and subtotal to get the total price. totalPrice = (addTax + subPrice); // Round the total price. finalPrice = roundPrice(totalPrice); // Update the form with the total cost. self.document.forms[0].cost.value = finalPrice; // Update the form with the number of line items. self.document.forms[0].items.value = partcount; } function orderIt(form) { // If the order is zero, display a message. if (form.cost.value == "0.00") { alert("You have not ordered anything. Please select an item and re-submit your order.") } else { if (form.elements[0].value == "") { nag(form, form.elements[0].name,0) } else if (form.elements[1].value == "") { nag(form, form.elements[1].name, 1) } else if (form.elements[2].value == "") { nag(form, form.elements[2].name, 2) } else if (form.elements[4].value == "") { nag(form, form.elements[4].name, 4); } else if (form.elements[5].value == "") { nag(form, form.elements[5].name, 5); } else if (form.elements[6].value == "") { nag(form, form.elements[6].name, 6); } else if (form.elements[10].value == "") { nag(form, form.elements[10].name, 10); } else { var message = "You have ordered the following items:\n"; message = message + "Qty\tCost\tDescription\n"; // Step through each element in the form. for (i = 0; i < parseInt(self.document.forms[0].elements.length); i++) { // If the form element has "qty" in the name then we need to process it. if (self.document.forms[0].elements[i].name.substring(0,3) == 'qty' && self.document.forms[0].elements[i].value !=0) { // Get the quantity. qtyItem = self.document.forms[0].elements[i].value; costItem = self.document.forms[0].elements[i-2].value; // Get the description. descItem = self.document.forms[0].elements[i-1].value; // add the line item to the confirmation message. message = message + qtyItem + "\t" + costItem + "\t" + descItem + "\n"; } } message = message + "\nOrder total: $" + self.document.forms[0].cost.value if (confirm(message)) { self.document.forms[0].submit(); } } } } // end hiding from older browsers --> </script> </head> <body bgcolor="white" text="black" alink="red" vlink="purple" link="blue" background="images/bkgrd.gif"> <p> <table width=440> <tr><td> <p> <form name=options method=post action="/cgi-bin/order.cgi"> <table border="0" width="100%" id="table1"> <tr> <td width="109" align="right"><font face="Arial" size="2"> First Name:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=FirstName size=30 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Last Name:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=LastName size=30 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Address Line 1:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=Address1 size=40 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Address Line 2:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=Address2 size=40 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Suburb:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=Suburb size=25 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">City:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=City size=25 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Postal Code:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=PostalCode size=15 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Country:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=Country size=15 maxlength=40 value=NZ></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Home Phone:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=HomePhone size=20 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Mobile Phone:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=MobilePhone size=20 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">E-Mail Address:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=EmailAddress size=30 maxlength=40></font></td> </tr> <tr> <td width="109" align="right"><font face="Arial" size="2">Domain Name:</font></td> <td width="15"> </td> <td align="left"><font size="1" face="Arial"> <input type=text name=DomainName size=30 maxlength=40></font></td> </tr> </table><br> <font face="Arial" size="2">Enter a quantity of 1 into the package you require.<br><br> Monthly payments incur a $2 per month administration fee. Set up is <b>free</b> for all packages (for a limited time).</font><br><br> <table border=1 cellpadding=2 width="500" bordercolorlight="#808080"> <tr> <th><font face="Arial" size="2">Description</font></th> <th><font face="Arial" size="2">Qty</font></th> <th><font face="Arial" size="2">Total</font></th> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc1" value="Basic Monthly"> </font><font face="Arial" size="2">Basic Package <BR><B> Pay Monthly</B></font></td> <td align=center><font size="1" face="Arial"><input type=text name="qty1" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center><font size="1" face="Arial"><input type=hidden name="cost1" value="11.99"> </font><font face="Arial" size="2">$11.99</font></td> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc2" value="Basic PrePay 1 Year"> </font><font face="Arial" size="2">Basic Package - $9.99 per month<BR><B> Pre-pay 12 mths (1 month free limited offer) </B> </font></td> <td align=center><font size="1" face="Arial"><input type=text name="qty2" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center><font size="1" face="Arial"><input type=hidden name="cost2" value="109.89"> </font><font face="Arial" size="2">$109.89</font></td> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc3" value="Basic PrePay 2 Years"> </font><font face="Arial" size="2">Basic Package - $8.99 per month<BR><B> Pre-pay 24 mths (2 months free limited offer) </B> </font></td> <td align=center><font size="1" face="Arial"><input type=text name="qty3" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center><font size="1" face="Arial"><input type=hidden name="cost3" value="197.78"> </font><font face="Arial" size="2">$197.78</font></td> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc4" value="Basic PrePay 3 Years"> </font><font face="Arial" size="2">Basic Package - $7.99 per month<BR><B> Pre-pay 36 mths (3 months free limited offer) </B> </font></td> <td align=center><font size="1" face="Arial"><input type=text name="qty4" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center><font size="1" face="Arial"><input type=hidden name="cost4" value="263.67"> </font><font face="Arial" size="2">$263.67</font></td> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc13" value="Deluxe Monthly"> </font><font face="Arial" size="2">Deluxe Package<BR><B> Pay Monthly</B></font></td> <td align=center><font size="1" face="Arial"><input type=text name="qty13" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center><font size="1" face="Arial"><input type=hidden name="cost13" value="21.99"> </font><font face="Arial" size="2">$21.99</font></td> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc14" value="Deluxe PrePay 1 Year"> </font><font face="Arial" size="2">Deluxe Package - $19.99 per month<BR><B> Pre-pay 12 mths (1 month free limited offer) </B> </font></td> <td align=center><font size="1" face="Arial"><input type=text name="qty14" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center><font size="1" face="Arial"><input type=hidden name="cost14" value="219.89"> </font><font face="Arial" size="2">$219.89</font></td> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc15" value="Deluxe PrePay 2 Years"> </font><font face="Arial" size="2">Deluxe Package - $18.99 per month<BR><B> Pre-pay 24 mths (2 months free limited offer) </B> </font></td> <td align=center><font size="1" face="Arial"><input type=text name="qty15" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center><font size="1" face="Arial"><input type=hidden name="cost15" value="417.78"> </font><font face="Arial" size="2">$417.78</font></td> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc16" value="Deluxe PrePay 3 Years"> </font><font face="Arial" size="2">Deluxe Package - $17.99 per month<BR><B> Pre-pay 36 mths (3 months free limited offer) </B> </font></td> <td align=center><font size="1" face="Arial"><input type=text name="qty16" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center><font size="1" face="Arial"><input type=hidden name="cost16" value="593.67"> </font><font face="Arial" size="2">$593.67</font></td> </tr> </table> <font face="Arial" size="2"> <br> </font> <table border=1 cellpadding=2 width="500" bordercolorlight="#808080"> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc17" value="Blogging Software Installation Service"> </font><font face="Arial" size="2">Installation Service<BR><B> Blogging software (Wordpress etc)</B></font></td> <td align=center width="39"><font size="1" face="Arial"><input type=text name="qty17" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center width="63"><font size="1" face="Arial"><input type=hidden name="cost18" value="39.00"> </font><font face="Arial" size="2">$39.00</font></td> </tr> <tr> <td align=center><font size="1" face="Arial"><input type=hidden name="desc19" value="Shopping Cart Installation Service"> </font><font face="Arial" size="2">Installation Service<BR><B> Shopping Cart (ZenCart, osCommerce, Cubecart etc)</B></font></td> <td align=center width="39"><font size="1" face="Arial"><input type=text name="qty19" size=3 maxlength=3 value="0" onchange="updatePrice()"></font></td> <td align=center width="63"><font size="1" face="Arial"><input type=hidden name="cost19" value="349.00"> </font><font face="Arial" size="2">$349.00</font></td> </tr> </table> <p> <table width=500> <tr> <td align=right> <div align="left"> <table cellpadding=1 cellspacing=1> <tr> <td colspan=2 align=right><font face="Arial" size="2">Sub Total: $</font><font size="1" face="Arial"><input name=subtot value="0.00" size=10 maxlength=10 onChange="updatePrice()"></font></td> </tr> <tr> <td valign=bottom><font size="1" face="Arial"><input type=hidden value=".15" name=taxrate size=5 maxlength=5 onchange="updatePrice()"> </font></td> <td align=right><font face="Arial" size="2">GST: $</font><font size="1" face="Arial"><input type=text name=totaltax size=10 maxlength=10 value="0.00" onChange="updatePrice()"></font></td> </tr> <tr> <td colspan=2 align=right><font face="Arial" size="2">Total Order: $</font><font size="1" face="Arial"><input name="cost" type=text value="0.00" size=10 maxlength=10 onChange="updatePrice(this.form)"><input type=hidden maxlength=4 size=4 name=items></font></td> </tr> </table> </div> <p> <font size="1" face="Arial"> <input type=button value="Submit Order" onClick="orderIt(this.form);" style="float: left"></font><font face="Arial" size="2"> </font><font size="1" face="Arial"> <input type=reset value="Clear Order" style="float: left"><font face="Arial" size="2"> </form> </font></font> </center> </body> </html> Hi, im wondering if anyone can help me, i have a random image script and it works fine, apart from when you click on the images they link to the right place but ALL go to _self I want [2],[3]and[6] to link to the places they are already linking to but _blank NOT _self, does anyone know how to do this, it would be a massive help :) Below is the code for the script i am using: Code: <script language="JavaScript"> function random_imglink(){ var myimages=new Array() //specify random images below. You can have as many as you wish myimages[1]="images/layout/bottom gallery.png" myimages[2]="images/layout/bottom facebook.png" myimages[3]="images/layout/bottom twitter.png" myimages[4]="images/layout/bottom team.png" myimages[5]="images/layout/bottom whats on.png" myimages[6]="images/layout/bottom forum.png" //specify corresponding links below var imagelinks=new Array() imagelinks[1]="gallery.html" imagelinks[2]="http://www.facebook.com/tos.php?api_key=fcddbaae811ef62bf3c4fb2ac7b1fd07&next=http%3A//dailyphoto-1402445175.us-east-1.elb.amazonaws.com/dailyphoto/applications/buffer/id%3A1/pid%3A2828044108236222753/from%3Apublisher.attachment.own.image?ref=nf&v=1.0&canvas#/group.php?gid=87957825200&ref=ts" imagelinks[3]="https://twitter.com/groundzereo" imagelinks[4]="team.html" imagelinks[5]="whatson.html" imagelinks[6]="http://groundzero.forumotion.co.uk/" var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>') } random_imglink() //--> </script> Thanks in advance =) |