JavaScript - Need Some Idea Or Logic On Java Script Slide Load Automatically And Click-able
Hey there. I'm creating my web-site now. I'm planing to have some slide/object change by itself. I know Java Script perform this task. I have get the code and apply to the image I want. It works. My idea is each of my image upper left corner have the representative number of the slide. When the slide1 go to slide 2 automatically, the number will change colour from 1 to 2. When the user click the number, the slide will change according to the number. Let said I have 3 slide. Each slide and have no 1 ,2 ,3 move forward, move backward icon on the upper left corner. I have slide1 ,slide2, slide3 change by itself within 2.5 second. When the user go thru slide 1, slide 2 and till slide3, user find out he/she interested on slide 1 and by clicking 1 on the upper left corner, the slide will change back to slide 1. Something like showing on the home page at www.easyjet.com.EN or http://www.thomascook.com/ . Both home page show a slide. This is what exactly I want. I learn HTML code before but not Java Script. I have borrow many Java Script reference book. but no idea how to inside the number on the upper left corner on each slide and how the number work accordingly with the slide.
So sorry if you can't understand what I was talking about. But, anyone who understand me or have any idea how can I mortify the Java script to what I want. Just answer or email me to trista_soo@yahoo.com or facebook me on sym107@hotmail.com. Thanks for your time and efforts. Your help I really appreciate. Cheers! Similar TutorialsHi there This is basically what I want to do: I want to have a slideshow that reads content of a folder and then shows the pictures and has a little fade animation between each image transition. to achieve this: I've done the following: 1. I'm using a php script to read the contents of a folder and spits out results in an array that I can use with my java script 2. im using jquery.cycle plugin to add the "fade" effect. Now my problem is My images are shown but i cant get the fade animation to work on my images. here is how my code looks like: My php file: PHP Code: <? //PHP SCRIPT: getimages.php header('content-type: application/x-javascript'); //This function gets the file names of all images in the current directory //and ouputs them as a JavaScript array function returnimages($dirname="./images") { $pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)"; //valid image extensions $files = array(); $curimage=0; if($handle = opendir($dirname)) { while(false !== ($file = readdir($handle))){ if(eregi($pattern, $file)){ //if this file is a valid image //Output it as a JavaScript array element echo 'galleryarray['.$curimage.']="'.$file .'";' . "\n"; $curimage++; } } closedir($handle); } sort($files); return($files); } echo 'var galleryarray=new Array();' . "\n"; //Define array in JavaScript returnimages() //Output the array elements containing the image file names ?> My html file: Code: <html> <meta http-equiv="refresh" content="1000"/> <head> <title>Media Signage Slideshow</title> <style type="text/css"> .pics { height: 232px; width: 232px; padding: 0; margin: 0; } .picsimg { padding: 0px; border: 0px solid #ccc; background-color: #eee; width: 200px; height: 200px; top: 0; left: 0 } #slideshow { height: 100%px; width: 100%px; margin: auto } #slideshow img { padding: 15px; border: 1px solid #ccc; background-color: #eee; } #slide {width: 370px; height: 220px; padding: 0; margin: 0 auto; } #myslides { width: 370px; height: 220px; padding: 0; margin: 0 auto; } #myslides img { padding: 10px; border: 1px solid rgb(100,100,100); background-color: rgb(230,230,230); width: 350px; height: 200px; top: 0; left: 0 } </style> </head> <!-- include jQuery library --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <!-- include Cycle plugin --> <script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#myslides').cycle({ fx: 'fade', speed: 5000, timeout: 2000 }); }); </script> <script type="text/javascript"> var curimg=0; function rotateimages(){ galleryarray.sort(); document.getElementById("myslides").setAttribute("src", "images/"+galleryarray[curimg]); curimg = (curimg+1) % galleryarray.length; } $('#myslides').ready(function() { $('#myslides').fadeOut('slow', function() { // Animation complete. }); }); window.onload = function(){ setInterval("rotateimages()", 5000); } </script> <script type="text/javascript" language="JavaScript" src="./code.php"></script> <body> <img id="myslides" src="100.jpg"> <?php echo $files ?> <!-- <div id="myslides"> --> <!--<img src="100.jpg" /> <img src="101.jpg" /> --> </body> </html> Please tell me how to fix it. Hey guys, I've just started with javascript so please, be gentle I am making a wordpress plug-in which puts a banner-rotator on the front page which is able to load both images and flvs'. It has a carousel menuand the images/objects are loaded as you hover over the thumbnails. I have made an js array in a php loop so that every element of the menu list gets assigned a different onMouseOver function when it is generated. Because I was not able to change FlashVars with js I have put the whole object embed code in one variable and insert that in a div with innerHTML when mouseOver. This works fine in firefox but not at all in any other browsers!! What can I do? The website is located at: www.mediapod.org/jwp Here is the code: Code: function wp_main_player() { global $wpdb; $noChartsID = $wpdb->get_col($wpdb->prepare("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id = 5")); $noCharts = count($noChartsID); ?> <div class="box" style="height:350px;"> <div id="maind" style="height:280px;"> <div id="icont"> <a id="link" href="#"><img name="main" height="280" width="560" src="" /></a> </div> <div id="fcont" style="display:none; width:100%; height:100%; background:#fff;"> </div> </div> <a class="pprev" style="float:left; width:10px; height:60px; margin-top:10px;" href="javascript:void(0)"></a> <div class="player" style="float:left; margin-top:11px; width:540px !important;"> <script> var myCode = []; </script> <ul style="float:left;"> <?php if ($noCharts > 0) { for ($i = 0; $i < $noCharts; $i += 1) { $posts = $wpdb->get_row("SELECT * FROM wp_posts WHERE id = $noChartsID[$i]", ARRAY_A); $link = $wpdb->get_row("SELECT * FROM wp_postmeta WHERE post_id = $noChartsID[$i] AND meta_key ='link'", ARRAY_A); $link = $link['meta_value']; $image = $posts['post_content']; $flv = strpos($image, 'flv:'); if ($flv==1){ $flv = str_replace("-flv:", "", $image); $flv = substr(rstrstr($flv, '-img:'),0 ,-6); $image = substr(strstr($image, '-img:'), 5); ?> <script> myCode[<?php echo $i; ?>]=<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="560" height="280" id="FlashXMLShoutcastRadioPlayerV4.0" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="http://www.mediapod.org/jwp/wp-content/plugins/JRockControll/FLVPlayer_Progressive.swf" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="wmode" value="opaque" ></param> <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=http://www.mediapod.org/jwp/wp-content/plugins/JRockControll/Corona_Skin_1&streamName=<?php echo $flv; ?>&autoPlay=true&autoRewind=false" /> <param name="bgcolor" value="#111111" /> <embed bgcolor="#111111" wmode="opaque" src="http://www.mediapod.org/jwp/wp-content/plugins/JRockControll/FLVPlayer_Progressive.swf" menu="false" FlashVars ="&MM_ComponentVersion=1&skinName=http://www.mediapod.org/jwp/wp-content/plugins/JRockControll/Corona_Skin_1&streamName=<?php echo $flv; ?>&autoPlay=true&autoRewind=false" quality="high" width="560" height="280" name="FlashXMLShoutcastRadioPlayerV4.0" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>; </script> <li class="p_img"><img onmouseover="document.getElementById('icont').style.display='none';document.getElementById('fcont').style.display=''; document.getElementById('fcont').innerHTML=myCode[<?php echo $i; ?>]; document.main.src='<?php echo $image;?>'; document.getElementById('link').href='<?php echo $link;?>';" src="<?php echo $image;?>" height="52" width="102" /></li> <?php } else { ?> <li class="p_img"><img onmouseover="document.getElementById('icont').style.display=''; document.getElementById('fcont').innerHTML=''; document.getElementById('fcont').style.display='none'; document.main.src='<?php echo $image;?>'; document.getElementById('link').href='<?php echo $link;?>';" src="<?php echo $image;?>" height="52" width="102" /></li> <?php } } } ?> </ul> </div> <a class="pnext" style="float:right; width:10px; height:60px; margin-top:10px;" href="javascript:void(0)"></a> <script type="text/javascript"> jQuery(function() { jQuery(".player").jCarouselLite({ btnNext: ".pnext", btnPrev: ".pprev", speed: 300, visible: 5 }); }); </script> </div> <?php } It is an absolute mess Thank you. i hope this is the right section to post this in. wasnt sure if this question was client side or server side i have a javascript slideshow that i would like to add to my website. its free to use and it came with some coding when downloaded. my problem is that this is my first time EVER using java (ive fiddled with php tho ) and i cant get the slide show to work on my site. the coding it came with gives you an entire webpage ... i just need the slideshow to go inside a div container instead of being a whole page the following is an embedded style that you can simply copy and paste to notepad, save as an html file, and open in your browser. (im using firefox) all the images etc are already being hosted. so you have to do nothing but open it in your browser to see the script working. like i said, this is the code for an entire webpage ... i just need the slide show by it self in a div container Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TinySlider - JavaScript Slideshow</title> <style all="media" title="YourConnexx Media" type="text/css"> * {margin:0; padding:0} body {font:12px Verdana,Arial; color:#555; background:#222 url(images/bg.jpg) 50% 0 no-repeat} p {line-height:1.4; margin-bottom:12px} #wrapper {width:578px; margin:75px auto} .sliderbutton {float:left; width:32px; padding-top:134px} .sliderbutton img {cursor:pointer} .sliderbutton img:hover {background:#666} #slider {float:left; position:relative; overflow:auto; width:500px; height:300px; border:2px solid #fff; background:#fff} #slider ul {position:absolute; list-style:none; top:0; left:0} #slider li {float:left; width:500px; height:300px; padding-right:10px} .pagination {float:left; list-style:none; height:25px; margin:15px 0 0 32px} .pagination li {float:left; cursor:pointer; padding:5px 8px; background:#666; border:1px solid #999; margin:0 4px 0 0; text-align:center; color:#222} .pagination li:hover {background:#777; border:1px solid #bbb; color:#000} li.current {border:1px solid #ccc; background:#888} li#content {width:464px; height:270px; padding:15px 28px 15px 18px} #content h1 {font:22px Georgia,Verdana; margin-bottom:15px; color:#036} </style> <script type="text/javascript" src="script.js"></script> </head> <body> <div id="wrapper"> <div> <div class="sliderbutton"><img src="images/left.gif" width="32" height="38" alt="Previous" onclick="slideshow.move(-1)" /></div> <div id="slider"> <ul> <li id="content"> <h1>TinySlider - Simple JavaScript Slideshow</h1> <p>This super lightweight (1.5 KB) sliding JavaScript slideshow script can easily be customized to integrate with any website through CSS. You can add any content to it, not just images, and it gracefully degrades without JavaScript support. The script supports automatic rotation with the option to auto-resume, an active class on a navigation list if applicable, and a direction toggle (vertical or horizontal).</p> <p><em>For complete details visit <a href="http://www.leigeber.com/">leigeber.com</a>.</em></p> </li> <li><img src="photos/sea-turtle.jpg" width="500" height="300" alt="Sea turtle" /></li> <li><img src="photos/coral-reef.jpg" width="500" height="300" alt="Coral Reef" /></li> <li><img src="photos/blue-fish.jpg" width="500" height="300" alt="Blue Fish" /></li> </ul> </div> <div class="sliderbutton"><img src="images/right.gif" width="32" height="38" alt="Next" onclick="slideshow.move(1)" /></div> </div> <ul id="pagination" class="pagination"> <li onclick="slideshow.pos(0)">1</li> <li onclick="slideshow.pos(1)">2</li> <li onclick="slideshow.pos(2)">3</li> <li onclick="slideshow.pos(3)">4</li> </ul> </div> <script type="text/javascript"> var slideshow=new TINY.slider.slide('slideshow',{ id:'slider', auto:3, resume:true, vertical:false, navid:'pagination', activeclass:'current', position:0 }); </script> </body> </html> please show me what i need to get this slide show into a div container by it self. when i do it it doesnt work at all. it appears in the div container as a text area or something but it doesnt work at all. just shows the first slide and nothing else Is there some javascript that will make a link in a page be clicked on page load?
I have 4 images and these images are changing automatically with duration of 2 seconds with show hide animation. and there are 4 bullets with mentioned above 4 images. these bullets are highlighting for example if image number 1 is showing than bullet number 1 is highlighting. same thing for other 3 bullets and images please send me the code for it Hi, I would like to set the postcode Code: <?php echo $pubdetails['rsPostCode]; ?> as a default value in the form field so that the map area loads up automatically for instance the link above uses postcode bn11 3rg thanks Hello, i would like to advise me on sthg. I have built a website using a)MySQL b)HTML c)PHP and d)Javascript. My website consists of basic html pages/templates which have links to the left and point to another templates/pages. For example, i have 4 templates in my site 1st template is for: News 2nd : Library 3nd : Articles 4th : E-shop Each template consists of 1. a small menu with links,every link points to another page 2.space for the content/text of the html page 3. a form for searching in the website using php and a mysql database. Well, i'm thinking of adding some animation in my website using the jquery library.Let's say we have an accordion which has 4 choices and when the user clicks on the first choice the 1st template(NEWS) appears inside the slide of accordion,loads in the same slide, not in a new page!!!This is what i would like to do, place in each slide of the accordion one of my templates. CAn this be done??? Which are the disadvantages of adding in each slide of the accordion a different template for my site and remain in the same slide when the user clicks in one of the links of the template??? Consider that i'm using dynamic content and not static, i have a MySQL database behind. Also,as i have seen in most examples the options of accordion usually contain an image, a content, a text or links which open in a new window or tab not inside the slide!!!These links do not load in the same slide!!i would like to have a template which loads in the slide each time the user clicks on a link of it. CAn this be done?? I would be glad if sm could advise me! Thanks, in advance!!! I'm looking for code which does the following: When a visitor visits my website and clicks anywhere on the page, (regardless of where the mouse clicks) it will automatically redirect him to another site. I think an event listener might be a solution, but I'm not sure. Thanks a lot for any help on this If possible, I would like there to be a 2 second time delay before it does the redirection. javascript**** so so basically what i wana do is is preform a search in google... easy enough, thats working. what i need to do is to have the last searched link on the page be submited to display via javascript. essentially what i am doing is creating a "reverse" im feeling lucky button. i have no clue how to do this, im new to java, however, i was discussing with a friend the possibility of omiting results that started with http://google and searching from the bottom up to obtain the last result? anyone who was any input on how to get this to work would be appreciated thanks Hi all, Very new to this but I am trying to automate some webdownloads I need to do daily. I have a link I am trying to click via applescript do javascript I can return the frames html by doing tell application "Safari" do JavaScript "document.getElementById('iframesearch').contentDocument.getElementById('frmAccountList').innerH TML" in document 1 end tell the html returned contains the link link I want to click/fire <span id="SWGrdAccSearch_ctl06_lblAsterix"> </span> <a onclick="javascript:return getDefaultAccount('John Doe','0890','0','0');" id="SWGrdAccSearch_ctl06_lnkAccount" href="javascript:__doPostBack('SWGrdAccSearch $ctl06$lnkAccount','')">123456</a> how can I get his link to launch/fire? Any and all help deeply appreciated. This is a weird idea I have- i will try to explain it all (forgive me if i do not). i'm using xml to create dynamic content on the site i'm building for myself. now, i know there is a way to randomly load xml content using php- but i have zero experience with php (though i not afraid to learn it, if it is the only way to do this). here's what i want to do: i have (let's say) 4 "announcement" areas on a page, in addition to a "random info" bar off to the side. in each of these, i want to have randomly loaded xml content each time the page is refreshed/viewed. so if i have a "recent site news" section on the page, i would have a folder for "some code" to look in to pull out an xml file to display. etc etc. basically, i'm wondering if there is a java way to do this (perhaps similar to the choosePic function?). it doesn't have to load a different xml file each time the page is refreshed either- if there's a way to pick a set number of items from any xml file i specify- that would be ok too. any help would be greatly appreciated. Hi all I have an asp page page with a DIV container that is activated when a user clicks a link (using javascript to activate it. It pops up similar to a light box). The contents of the DIV is an Iframe from another website. The Iframe is hidden when the page loads. Loading in the Iframe when the page loads is affecting performance of the page. I'm wondering if there is a way to load the Iframe when the user clicks the link to activate the DIV light box. This way the page doesn't have to load the Iframe straight away... only when the user needs it... I appreciate any ideas. Hello Again, After much help and support i have decided that the best way to do what i want (if i can get it working is like the below). The idea is to click a link and content will load into a div from another div on another page in the same webspace. I can make a test page as directed by the guidance i recieved but there are some features that wont work properly or are not what i am after. For example in the test case the link to load the div is inside the div i want to update. In my case i want to click on the algebra link in the blue horizontal menu and then the main menu updates. I wont lie i have not got the skills to adapt this script on my own. here is the test page http://www.bushcottages.co.uk/loaddata.htm the main page i would like it to work on as its not working correctly is http://www.bushcottages.co.uk/new.htm test code is Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Click This Link To Load My Favor</title> <script type="text/javascript" src="java/jquery-1.5.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#loadData").click(function() { $(this).text("...One Moment Please..."); $("#container").append('<div id="favoriteMovies"></div>') .children("#favoriteMovies").hide() .load("theOtherPage.htm ul#favoriteMovies", function() { $("#loadData").remove(); $("#favoriteMovies").slideDown("slow"); }); return false; }); }); </script> <style type="text/css"> #container { width: 300px; height: 200px; font-family: georgia; font-weight: bold; border-style: solid; border-width: 2px; border-color: #000066; } </style> </head> <body> <div id="container"> <li><a href="#" id="loadData">Click This Link To Load My Favorite Movies</a></li> </div> </body> </html> code for main page is Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Mathematics Learning Zone</title> <meta name="description" content="Learn Key Stage 4 Mathematics and Achieve a Grade C."> <meta name="keywords" content="Maths, Mathematics, Key Stage 4, Key Stage 4 Maths, GCSE Maths, Maths Grade C"> <meta name="author" content="Peter Devlin"> <script type="text/javascript" src="java/jquery-1.5.min.js"></script> <script type="text/javascript" src="http://www.bushcottages.co.uk/java/jquery.newsTicker-1.2.2.js"></script> <script type="text/javascript"> <!-- $(document).ready(function() { if (document.getElementById('news')) { var options = { newsList: "#news", tickerRate: 20, loopDelay: 6000, startDelay: 10, placeHolder1: "_" } $().newsTicker(options); } }); --> </script> <script type="text/javascript"> $(document).ready(function() { //Default Action $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active content return false; }); }); </script> <script type="text/javascript"> var newwindow; function poptastic(url) { newwindow=window.open(url,'brainteasersolution.htm','height=400,width=400,left=40%,top=20%'); if (window.focus) {newwindow.focus()} } </script> <script type="text/javascript"> $(document).ready(function() { $("#number").click(function() { $(this).text("...One Moment Please..."); $("#container").append('<div id="Algebra"></div>') .children("#Algebra").hide() .load("Algebra.htm ul#algebra", function() { $("#number").remove(); $("#Algebra").slideDown("slow"); }); return false; }); }); </script> <style type="text/css"> * { border: 0; margin: 0; padding-top:0; } #topmargin { width:900px; height:5px; margin:auto; } #banner { width: 900px; height: 70px; background-image: url('banner.png'); margin: auto; margin-bottom: 5px; background-color: #000066; } #horizontalmenu { width: 900px; height: 25px; margin: auto; margin-bottom: 5px; background-color: #000066; } #horizontalmenu ul { list-style-type: none; margin: 0px; padding: 2px 0px 0px 0px; } #horizontalmenu ul li { float: left; display: block; text-align: center; width: 300px; } #horizontalmenu ul li a { text-decoration: none; font-family: georgia; font-size: 1em; color: #fafafa; } #horizontalmenu ul li a:hover { font-family: georgia; font-size: 1em; padding: 5px 40px 5px; color: #000000; background-color: #ffffff; } #mainpage { width: 900px; margin: auto; } #one { float: left; width: 150px; margin-right: 5px; } #two { float: left; width: 590px; margin-right: 5px; } #three { float: left; width: 150px } #verticalmenu { float: left; width: 150px; } #verticaltopmenu { float: left; width: 150px; height: 23px; background-color: #000066; } #verticalmainmenu { float: left; width: 146px; height: 372px; text-decoration: none; border-style: solid; border-width: 2px; border-color: #000066; padding-top: 2px; padding-bottom: 2px; } #verticalmainmenu ul { text-decoration: none; list-style: none; padding: 0px; margin: 0px; color: black; } #verticalmainmenu ul li { list-style: none; text-decoration: none; display: block; padding: 0px; text-align: left; font-family: georgia; font-size: .8em; color: black; } #verticalmainmenu ul li a { padding: 0px 0px 0px 5px; text-decoration: none; text-align: left; color: black; } #verticalmainmenu a:hover { background-color: white; color: #000066; } #tickercontainer { float: left; width: 586px; height: 21px; margin-bottom: 5px; border-color: #000066; border-style: solid; border-width: 2px; } #tickersidetitle { float: left; width: 125px; height: 21px; background-color: #000066; } #tickercontent { float: left; width: 461px; height: 21px; padding: 0px; } ul#news { margin: 0px; height: 21px; padding: 0px 0px 0px 0px; } ul#news li { list-style: none; font-family: georgia; font-size: 14px; font-weight: bold; color: #004400; margin: 0px; padding: 0px 0px 0px 10px; } ul#news li a:link, ul#news li a:hover { color: #004400; text-decoration: none; } #contentwindow { float: left; width: 590px; } ul.tabs { width: 590px; /*--Set width of container--*/ height: 23px; /*--Set height of tabs--*/ margin: 0px; padding: 0px; float: left; list-style: none; border-bottom: 2px solid #000066; /*--Set line at bottom of ul--*/ } ul.tabs li { float: left; margin-right: 1px; /*adjusts gap between tabs*/ height: 23px; /*--Subtract 1px from the height of the unordered list--*/ line-height: 23px; /*--Vertically aligns the text within the tab--*/ margin-bottom: -2px; background: #000066; border-color: #000066; border-style: solid; border: 2px; } ul.tabs li a { text-decoration: none; color: #FFFFFF; font-family: georgia; font-size: 14px; display: block; padding: 0 20px; } ul.tabs li.active a { color:#000000; border-color: #000066; border-style: solid; border: 2px; } ul.tabs li a:hover { background-color: #330099; border: 0px; } ul.tabs li.active, ul.tabs li.active a:hover /*--Makes sure that the active tab does not listen to the hover properties--*/ { color: #000000; background: #FFFFFF; border-color: #000066; border-style: solid; border: 2px 2px 2px 0px; border-bottom: 2px solid #FFFFFF; /*--Makes the active tab look like it's connected with its content--*/ } .tab_container { border: 2px solid #000066; border-top: none; overflow: hidden; clear: both; float: left; width: 586px; height: 346px; background: #FFFFFF; } .tab_content { padding: 20px; font-size: 1.2em; } #testsmenu { float: left; width: 150px; margin-bottom: 5px; } #teststopmenu { width: 150px; height: 23px; background-color: #000066; } #testsmainmenu { float: left; width: 146px; height: 70px; border-style: solid; border-width: 2px; border-color: #000066; } #testsmainmenu ul { float: left; margin-top: 2px; margin-bottom: 2px; width: 146px; padding: 0px; } #testsmainmenu ul li { font-family: georgia; font-size: 0.8em; list-style-image: url('test.png'); margin-left: 30px; padding: 0px; text-align: left; } #testsmainmenu ul li a { padding: 0px; text-decoration: none; text-align: left; color: black; } #testsmainmenu ul li a:hover { background-color: white; color: #000066; } #downloadsmenu { float: left; width: 150px; margin-bottom: 5px; } #downloadstopmenu { width: 150px; height: 23px; background-color: #000066; } #downloadsmainmenu { float: left; width: 146px; height: 70px; border-style: solid; border-width: 2px; border-color: #000066; } #downloadsmainmenu ul { float: left; margin-top: 2px; margin-bottom: 2px; width: 146px; padding: 0px; } #downloadsmainmenu ul li { font-family: georgia; font-size: 0.8em; list-style-image: url('download.png'); margin-left: 30px; padding: 0px; text-align: left; } #downloadsmainmenu ul li a { padding: 0px 0px 0px 5px; text-decoration: none; text-align: left; color: black; } #downloadsmainmenu ul li a:hover { background-color: white; color: #000066; } #worksheetsmenu { float: left; width: 150px; margin-bottom: 5px; } #worksheetstopmenu { width: 150px; height: 23px; background-color: #000066; } #worksheetsmainmenu { float: left; width: 146px; height: 70px; border-style: solid; border-width: 2px; border-color: #000066; } #worksheetsmainmenu ul { float: left; margin-top: 2px; margin-bottom: 2px; width: 146px; padding: 0px; } #worksheetsmainmenu ul li { font-family: georgia; font-size: 0.8em; list-style-image: url('worksheet.png'); margin-left: 30px; padding: 0px; text-align: left; } #worksheetsmainmenu ul li a { padding: 0px 0px 0px 5px; text-decoration: none; text-align: left; color: black; } #worksheetsmainmenu ul li a:hover { background-color: white; color: #000066; } #weblinksmenu { float: left; width: 150px; margin-bottom: 5px; } #weblinkstopmenu { width: 150px; height: 23px; background-color: #000066; } #weblinksmainmenu { float: left; width: 146px; height: 70px; border-style: solid; border-width: 2px; border-color: #000066; } #weblinksmainmenu ul { float: left; margin-top: 2px; margin-bottom: 2px; width: 146px; padding: 0px; } #weblinksmainmenu ul li { font-family: georgia; font-size: 0.8em; list-style-image: url('links.png'); margin-left: 30px; padding: 0px; text-align: left; } #weblinksmainmenu ul li a { padding: 0px 0px 0px 5px; text-decoration: none; text-align: left; color: black; } #weblinksmainmenu ul li a:hover { background-color: white; color: #000066; } p { text-align: center; font-family: georgia; font-size: 1em; color: #FFFFFF; padding-top: 2px; } p.a { text-align: center; font-family: georgia; font-size: 1em; color: #FFFFFF; padding-top: 0px; } p.b { text-align: center; font-family: georgia; font-size: 1em; color: #000000; padding-top: 0px; } p.c { text-align: center; font-family: georgia; font-size: 8px; color: #000000; padding-top: 0px; } </style> </head> <body> <div id="topmargin"></div> <div id="banner"></div> <div id="horizontalmenu"> <ul> <li> <a href="#" id="number">Number and Algebra</a></li> <li><a href="url">Geometry and Measures</a></li> <li><a href="url">Statistics - Data Handling</a></li> </ul> </div> <div id="mainpage"> <div id="one"> <div id="verticalmenu"> <div id="verticaltopmenu"><p>Main Menu</p></div> <div id="verticalmainmenu"> <ul> <li><a href="url">Angles</a></li> <li><a href="url">Properties of Shapes</a></li> <li><a href="url">Circle Theorems</a></li> <li><a href="url">Geometry of Cuboids</a></li> <li><a href="url">2d and 3d Shapes</a></li> <li><a href="url">Area</a></li> <li><a href="url">Perimeter</a></li> <li><a href="url">Prisms</a></li> <li><a href="url">Surface Area</a></li> <li><a href="url">Using Pi</a></li> <li><a href="url">Volumes</a></li> <li><a href="url">Transformations</a></li> <li><a href="url">Scale</a></li> <li><a href="url">Coordinates</a></li> <li><a href="url">Vectors</a></li> <li><a href="url">Bearings</a></li> </ul> </div> </div> </div> <div id="two"> <div id="tickercontainer"> <div id="tickersidetitle"><p class="a">Brainteasers</p></div> <div id="tickercontent"> <ul id="news"> <li>How many Degrees in a Triangle?</li> <li><a href="javascript:poptastic('brainteasersolution.htm');">Algebra - What is 4x = 20 - X? Click for answer</a></li> <li><a href="http://www.bushcottages.co.uk/1.htm">What is the most common class Called?</a></li> </ul> </div> </div> <div id="contentwindow"> <ul class="tabs"> <li><a href="#tab1">Acute</a></li> <li><a href="#tab2">Obtuse</a></li> <li><a href="#tab1">Reflex</a></li> <li><a href="#tab2">Vertex</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content"> <p class="b">hello</p> <p class="c">Page Created by P.Devlin</p> </div> <div id="tab2" class="tab_content"> <p class="b">well done</p> <p class="c">Page Created by P.Devlin</p> </div> </div></div> </div> <div id="three"> <div id="testsmenu"> <div id="teststopmenu"><p>Online Tests</p></div> <div id="testsmainmenu"> <ul> <li><a href="url">Linear Graphs</a></li> <li><a href="url">Equations</a></li> <li><a href="url">Averages</a></li> <li><a href="url">Algebra</a></li> </ul> </div> </div> <div id="downloadsmenu"> <div id="downloadstopmenu"><p>Downloads</p></div> <div id="downloadsmainmenu"> <ul> <li><a href="url">Linear Graphs</a></li> <li><a href="url">Equations</a></li> <li><a href="url">Algebra</a></li> <li><a href="url">Tests</a></li> </ul> </div> </div> <div id="worksheetsmenu"> <div id="worksheetstopmenu"><p>Worksheets</p></div> <div id="worksheetsmainmenu"> <ul> <li><a href="url">Linear Graphs</a></li> <li><a href="url">Equations</a></li> <li><a href="url">Algebra</a></li> <li><a href="url">Tests</a></li> </ul> </div> </div> <div id="weblinksmenu"> <div id="weblinkstopmenu"><p>Web Links</p></div> <div id="weblinksmainmenu"> <ul> <li><a href="url">Linear Graphs</a></li> <li><a href="url">Equations</a></li> <li><a href="url">Algebra</a></li> <li><a href="url">Tests</a></li> </ul> </div> </div> </div> </div> </body> </html> Many thank to you all for your help so far. Peter Hey guys. I need a Javascript that clicks on particular co-ordinates on page load. I'll even make do with a script that clicks on a random co-ordinate on page load. Just a simple click has to be made automatically on page load on the page. I tried using and editing this code: Code: <html> <head> <script> window.onload = function(){ document.getElementById("autoid").click(); } </script> </head> <body> <a href="http://google.com" id="autoid">Search Engine</a> </body> </html> but its of no use because I want it to click on another javascript, thats another Code: <script type="text/javascript"> [Script data goes here that takes about 700 x 700 pixels on the screen] </script> I want a click to be made on this script somehow. I can add Code: window.setTimeout('clickit()',5000); function clickit(){ location.href = document.getElementById("autoid"); myself which will delay it so the click occurs after page load but I just want a click to happen on top of that javascript. Any help will be greatly appreciated. Cheers! Is there a way onclick to load external html into a DIV tag, but without iFrame usage?
So I wrote a script to slide various divs horizontally. It takes 2 seconds to start and then begins, sliding, then stops, then slides, until all four slides are shown, and the slides back to the first one. My issue is I have two buttons that should take over and kill the auto sliding. Also the script is giving me errors. That mastertimer, and loopertimer is not defined... Why is that? Here is the code Code: <script type="text/javascript">// <![CDATA[ function restartSlide(item){ item.style.left = parseInt(item.style.left) + 60 +'px'; var resetLooperSl = setTimeout(function(){restartSlide(item)},15); if(parseInt(item.style.left) >= 0){clearTimeout(resetLooperSl);return;} } function stopSlide(){ clearTimeout(loopTimer); } function animateSlide(element,limit,transition){ if(transition == "stop" && parseInt(element.style.left) > -2460){ limit = limit - 820; } else if(transition == "stop" && parseInt(element.style.left) <= -2460){ limit = limit + 820; stopSlide(); } element.style.left = parseInt(element.style.left) -20 + 'px'; if(parseInt(element.style.left)<= limit){ setTimeout(function(){animateSlide(element,limit,"stop")},4000); clearTimeout(MasterTimer); } var loopTimer = setTimeout(function(){animateSlide(element,limit,"flow")},15); } function autoSlide(){ var MasterTimer; var RestarterTime; var adContainer = document.getElementById('adwrap'); adContainer.style.left = '0px'; MasterTimer = setTimeout(function(){animateSlide(adContainer,0,"stop")},3000); RestarterTimer = setTimeout(function(){restartSlide(adContainer)},25000); } addEvent(window, 'load', autoSlide); function btnSlideNow(elem, incremental){ elem.style.left = parseInt(elem.style.left) + incremental + 'px'; setTimeout(function(){btnSlideNow(elem, incremental)},30) } function btnActions(elem){ var incremental; if(elem.id == 'btnAdLeft'){incremental = 30} else if(elem.id == 'btnAdRight'){incremental = -30} btnSlideNow(elem, incremental); } function adButtons(){ document.getElementById('btnAdLeft').onclick = function(){btnActions(this)} document.getElementById('btnAdRight').onclick = function(){btnActions(this)} } addEvent(window, 'load', adButtons); // ]]></script> Also I'd like to see how you experienced scripters would write this cleaner. I'd like to see that, as I am new to js. It would help me learn. thanks Hi, I have a script that shows/hides a div but rather than making it sort of snap I would like to make it glide/slide. I have looked at other scripts but can't make them work with mine. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>test</title> <style type="text/css" media="screen"> /* CSS Reset */ * { margin: 0; padding: 0; border: 0; outline: 0; } body { font-family: Arial, Helvetica, sans-serif; background-color: #FFFFFF; color:#FF0000; } a:link { color: #999999; text-decoration: none; letter-spacing: 3px; font-size:14px; } a:visited { color: #999999; text-decoration: none; letter-spacing: 3px; font-size:14px; } a:hover { color: #FF0000; letter-spacing: 3px; text-decoration: none; font-size:14px; } a:active { color: #FF0000; font-size:14px; letter-spacing: 3px; } #wrapper{ position:relative; width:730px; height:600px; margin:0px auto; } #images{ width:730px; height:552px; overflow:hidden; float:right; position: absolute; top: 48px; } #textbox{ position: absolute; width:205px; height:40px; background-color: #FFFFFF; top: 68px; left: 20px; z-index: 2; padding: 10px; border-bottom: 2px solid red; } #logo { position: absolute; width: 101px; position: absolute; left: 634px; top: 19px; padding: opx; margin: 0px; z-index: 2; } .more { display: none; text-decoration: none; font-family: Arial, Helvetica, sans-serif; background-color: #FFFFFF; border-bottom: 2px solid red; padding-left: 8px; padding-right: 8px; margin-left: -10px; width: 209px; padding-bottom:10px; } a.mo hover { text-decoration: none;} a.showLink, a.hideLink { text-decoration: none; font-size: xx-small; color: #36f; padding-left: 8px; /*** background: transparent url(down.gif) no-repeat left;***/ } a.hideLink { /*** background: transparent url(up.gif) no-repeat left;***/ } .drop1 { font-size: 12px; font-weight: bold; } .drop2 { color: #666666; font-size: smaller; } #apDiv1 { position:absolute; left:319px; top:87px; width:234px; height:32px; z-index:1; } .init_image, .inactive_class { } .hover_class, #active_id { color:#F00; } </style> <script language="javascript"> function toggle() { var ele = document.getElementById("toggleText"); var text = document.getElementById("displayText"); if(ele.style.display == "block") { ele.style.display = "none"; text.innerHTML = "<img src=ShowProduct.jpg border='0'>"; } else { ele.style.display = "block"; text.innerHTML = "<img src=hideProduct.jpg border='0'>"; } } </script> <script type="text/javascript"> // Reference URL to large images here var Images = new Array( "001.jpg", "002.jpg", "003.jpg", "004.jpg" ); function swap(el) { var timgs=document.getElementsByTagName('a') for (var i_tem = 0; i_tem < timgs.length; i_tem++) if (timgs[i_tem].className=='inactive_class'||timgs[i_tem].className=='hover_class') timgs[i_tem].id='' el.id='active_id' document['imgMain'].src = Images[el.href.substr(el.href.lastIndexOf('#')+1)]; } function init(){ var timgs=document.getElementsByTagName('a') for (var i_tem = 0; i_tem < timgs.length; i_tem++) if (timgs[i_tem].className=='init_image'){ timgs[i_tem].className='inactive_class' timgs[i_tem].onmouseover=function(){this.className='hover_class'} timgs[i_tem].onmouseout=function(){this.className='inactive_class'} timgs[i_tem].onclick=function(){swap(this);return false;} } swap(document.getElementById('first')); } </script> </head> <body onLoad="init();"> <div id="wrapper"> <div id= logo><img src="logo2.png" width="101" height="92" /></div> <div id="textbox"> <div style="position:relative;"> <img style="padding-right:5px;" src="logo_dedon.png" alt=""/> <a href="javascript:toggle();" id="displayText"><img src=ShowProduct.jpg border="0"></a> <img style="padding-right:5px;" src="clear.gif" alt="" width="135" height="10" /> <a class="init_image" id="first" href="#0">1</a> <a class="init_image" id="first" href="#1">2</a> <a class="init_image" id="first" href="#2">3</a> <a class="init_image" id="first" href="#3">4</a> </div> <div id="toggleText" style="display: none;" class="more"> <p><span class="drop1">BARCELONA</span><br /> <span class="drop2">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin non mi in urna hendrerit tincidunt. Maecenas eleifend erat et lacus. Sed tempor. Sed venenatis consequat neque. Sed massa. Donec quis orci sed lacus ullamcorper venenatis. </span></p> </div> </div> <div id="images"> <div><img galleryimg="no" name="imgMain" src="img/big/1big.jpg" alt=""></div> </div> </div> </body> </html> Can anyone advise a solution for this please? Thanks alot Joe Having problems sliding a table row using scriptaculous. Using the code new Effect.SlideUp('test1');, the table row gets hidden but without the animation effects. While trying to research this, I saw a post in stackoverflow and someone said it's really hard to create animated effect for table rows. There's a solution there but it's for jQuery. Another solution is probably to use <div id="test1"> inside the <tr> instead but that creates XHTML error. Code for table table row: Code: <tr id="test1"><td>Hello World!</td></tr> Hey all, I'm trying to make it so that when a user clicks on a radio button, the image that is related to the radio button is displayed next to it (without reloading the page). At the moment all it shows is the image related to the currently saved option, which I'd like to keep on page load. Is this possible? If so, I'd appriciate any help. Here is my code for the radio buttons. Thanks. Code: <tr valign="top"> <td id="community-legal-services-logo-selection"> <p><label><?php _e('<strong class="table_tags">Display the following Community Legal Services logo:</strong>'); ?></p> <p><label for="cls-mono"> <input class="" id="cls-mono" name="cls_logo" type="radio" value="cls_mono" <?php if($general_options['cls_logo'] === 'cls_mono'){ echo 'checked="checked"'; } ?> /> <?php _e('Mono'); ?></label> </p> <p><label for="cls-color"> <input class="" id="cls-color" name="cls_logo" type="radio" value="cls_color" <?php if($general_options['cls_logo'] === 'cls_color'){ echo 'checked="checked"'; } ?> /> <?php _e('Colour'); ?></label> </p> <p><label for="cls-none"> <input class="" id="cls-none" name="cls_logo" type="radio" value="cls_none" <?php if($general_options['cls_logo'] === 'cls_none'){ echo 'checked="checked"'; } ?> /> <?php _e('None'); ?></label> </p> <p> <label><?php _e('<span class="table_tags">Link to the Community Legal Services website<span>'); ?></label> </p> <p> <input class="large_input_box" id="cls-link" name="cls_link" type="text" value="<?php echo $general_options['cls_link']; ?>" /></label> </p> </td> <?php if($general_options['cls_logo'] && $general_options['cls_logo'] !== 'cls_none'){ ?> <td> <img id="community-legal-services-logo-preview" class="image-preview" src="<?php echo $general_options['cls_logo_path']?>" /> </td> <?php } ?> </tr> |