JavaScript - Controls Not Clickable After Using Position:absolute
Hi,
Im having a weird issue... I am using position absolute to stick a table header to the top of a div. In the screenshot, under the menu is a div, the buttons and drop downs are at the "top" and grid starts from half way down, now when user scrolls till header is out of view i show the header at the "top" with position absolute. then when user scrolls back down and onto original position the buttons and drop downs are now again at the top exactly at the position where the header was shown, once the header has been shown all the buttons and the drop down are no longer clickable, i.e. there is no reaction, no dropdown shown and no click... whats happening is that IE is thinking that that area at the top where the header was is now invalid, or still occupied by the header or something like that? Its like the buttons and drop downs are kind of "behind" the area where the header was therefore nothing is clickable... And proof of this is that i gave some <BR> spacing to the buttons and drop downs so that they are not at the up most, but halfway down... and things work fine... whats IE up to? or is there some coding i need to do... below is the code for the header to float [it may be coz when the header is not to be shown i set the position to ' ', but i have tried with relative, fixed and static as well to no avail...] Code: <script language="javascript" type="text/javascript"> var floating_header = function() { this.header = document.getElementsByTagName('THEAD')[0].getElementsByTagName('TR')[0]; this.getXY = function(o) { var y = 0; var x = 0; while (o != null) { y += o.offsetTop; x += o.offsetLeft; o = o.offsetParent; } return { "x": x, "y": y }; } this.setheader = function() { if (window.header == undefined) { floating_header(); } var screenpos = this.scrollTop; var theady_max = window.getXY(window.table_obj.getElementsByTagName('THEAD')[0]).y + window.table_obj.offsetHeight; if (screenpos > window.theady - 100 && screenpos < theady_max) { window.header.style.position = 'absolute'; window.header.style.top = this.offsetTop; window.header.style.display = 'block'; window.headerOffsetTop = this.offsetTop; } else { if (screenpos != undefined && window.header != undefined) { window.header.style.position = ''; window.header.style.top = ''; window.headerOffsetTop = undefined; window.header = undefined; } else { if (window.headerOffsetTop) { window.header.style.position = 'absolute'; window.header.style.top = window.headerOffsetTop; window.header.style.display = 'block'; } } } } document.getElementById("divcn").onscroll = this.setheader; this.table_obj = document.getElementsByTagName('THEAD')[0].parentNode; this.theady = this.getXY(this.table_obj.getElementsByTagName('THEAD')[0]).y; }; floating_header(); </script> Similar TutorialsI'm new to javascript and am not sure why this works in firefox and not chrome. I am trying to create a script that keeps an object fixed horizontally while bing positioned absolute vertically. if I replace the toPP variable in document.getElementById('fire').style.top = toPP; with say '50px' it will move the element down 50 pxs, but how I have it currently it doesn't do anything in chrome Code: <script type="text/javascript" > window.onscroll = function() { if( window.XMLHttpRequest ) { var x = 0 -document.documentElement.scrollTop; var toP = String(x); var toPP = toP + "px"; document.getElementById('fire').style.position = 'fixed'; document.getElementById('fire').style.top = toPP; } } </script> I need to convert a position:fixed element to position:absolute when the user resize their browser window below 1000px. Right now it does nothing. The element always keeps the fixed positioning even after resizing the window. Here's what I have right now: Code: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <base href="http://www.area51entertainment.co/" /> <title>Emoto <?php echo "$section"; ?></title> <meta charset="UTF-8" /> <meta name="verify-v1" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta name="author" content="Andrew McCarrick" /> <meta name="robots" content="index, follow" /> <style type="text/css"> body,html { background: #FFFFFF; /* Old browsers */ color: #000000; font-family: Verdana; margin-right:auto; margin-left:auto; max-width:1000px; padding: 0px; margin-top: 0px; margin-bottom: 0px; } </style> <link rel="stylesheet" href="emoto/style.css" media="screen" /> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> <link rel="apple-touch-icon" href="http://www.area51entertainment.co/TouchIcon.png" /> <link rel="apple-touch-icon-precomposed" href="http://www.area51entertainment.co/TouchIcon.png" /> <link rel="image_src" href="./logo.png" /> <script language="javascript" src="emoto/float.js"></script> </head> <body> <div class="wrapper"> <div id="header_float"> <div class="header_wrapper"> <div class="logo"> Picture </div> <div class="links"> Home | Settings | Notifications | Requests | Messages | Search Bar </div> <div class="links_right"> Profile Link/Sign-Out </div> </div> </div> <div class="content_wrapper"> Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 T est2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2Test2Test2 Test2 </div> </div> </body> </html> style.css Code: a:link {color: #FFFFFF; text-decoration: none;} a:visited {color: #FFFFFF; text-decoration: none;} a:active {color: #FFFFFF; text-decoration: none;} a:hover {color: #3399FF; text-decoration: none;} .wrapper{ min-height: 2000px; min-width: 1000px; } #header_float{ width: 100%; min-width: 1000px; height: 35px; left:0; right:0; top:0; position: fixed; background: #49963A; z-index: 1000; } .header_wrapper{ width: 1000px; height: 35px; margin-right:auto; margin-left:auto; padding: 0px; margin-top: 0px; margin-bottom: 0px; color: #FFFFFF; } .logo{ float: left; width: 150px; height: 25px; font-size: 26px; position: relative; top: -1px; left: 8px; } .links{ float: left; width: 670px; height: 25px; position: relative; top: 7px; } .links_right{ float: right; width: 180px; height: 25px; position: relative; top: 7px; } .content_wrapper{ position: relative; top: 35px; width: 995px; min-height: 450px; } img{ border: 0px; } float.js Code: if (screen.availWidth<=999) document.getElementById('header_float').style.position = 'absolute'; else document.getElementById('header_float').style.position = 'fixed'; I have created a lightbox for user display on my site. The lightbox is triggered by an onclick link. Works great but I would like to make one switch to it. I would like the lightbox to appear position:fixed; top:10px; onclick. Then if the user scrolls I would like the lightbox to appear position:absolute; top:10px; You can see an example of this here on ESPN's website http://search.espn.go.com/first-take/videos/6. If you click any video it appears position fixed onclick but then position absolute on scroll. This is what I have so far. It shows it all position fixed onclick as I desire, but stays that way on scroll. PHP Code: <a href = "javascript:void(0)" onclick = "document.getElementById('light<?php echo $count;?>').style.display='block'; document.getElementById('light<?php echo $count;?>').style.position = 'fixed'; document.getElementById('light<?php echo $count;?>').style.top = '10px'; document.getElementById('fade<?php echo $count;?>').style.display='block'"> ... [link] ... </a> PHP Code: <div id="light<?php echo $count;?>" class="log-lightbox-content-wrapper"> ... [lightbox content] ... </div> PHP Code: <style> .log-lightbox-content-wrapper {display: none; position:absolute; top: -45px; left: 50%; margin-left: -456px; width: 900px; padding: 16px;background-color: white;z-index:1002; overflow: auto; border-color:#666; border-radius:5px; border-style:solid; border-width:5px; min-height:600px; height: auto !important; height:600px;} </style> Progress: http://instride.info/admin - Click tab that says log - Then click any log post to view light box Hello everyone, I just stumbled across this forum and thought maybe someone here could help me with a few coding alterations. I would like to position the rss feed selection fields on this feed output so I can scroll the feed with the selection fields remaining stationary. Code: <link rel="icon" type="image/png" href="rss_include/feed-icon-red.png"> <style language='text/css'> @import url('rss_include/style.css'); </style> <script language="javascript"> var XMLHttpRequestObject = false; var img = new Image(); img.src = "rss_include/loading.gif"; if ( window.XMLHttpRequest ) XMLHttpRequestObject = new XMLHttpRequest(); else if (window.ActiveXObject) XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); function changeOptions() { LoadFeed(); } function LoadFeed(value, initial) { if ( XMLHttpRequestObject ) { var dsource = "rss_include/ajax.php?loadfeed"; if (value) dsource += "=" + value; else { var val = document.getElementById("rss_feed").value; if ( val == "" ) document.getElementById("rss_feed").selectedIndex += 1; dsource += "=" + document.getElementById("rss_feed").value; } dsource += "&fulltext=" + document.getElementById("showtext").checked; dsource += "&showimages=" + document.getElementById("showimages").checked; XMLHttpRequestObject.open("GET",dsource); XMLHttpRequestObject.onreadystatechange = function() { if ( XMLHttpRequestObject.readyState != 4 ) { document.getElementById("rss_div").innerHTML = "<center><img class=\"loading\" src=\"" + img.src + "\"></center>"; } if ( XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200 ) { document.getElementById("rss_div").innerHTML = XMLHttpRequestObject.responseText; } } XMLHttpRequestObject.send(null); } } </script> <?php require_once("rss_include/config.php"); function LoadFile($xml_file) { $xml = null; if ( !file_exists($xml_file) || !($xml = simplexml_load_file($xml_file)) ) { echo '</select>'; echo "Error opening XML feeds file: $xml_file<br>"; return; } return $xml; } function ShowFeedOptions($xml_file) { echo '<select id="rss_feed" onChange="LoadFeed(this.value)" title="GuyWMustang.com RSS Reader">'; $xml = LoadFile($xml_file); if ( $xml == null ) return; $url = array(); foreach($xml->feeds->category as $category) { echo "<option value=\"\">" . $category['name'] . "</option>"; foreach($category->feed as $feed) { if ( $feed['name'] != "" ) { // Add a spacing to the feeds $name = " " . $feed['name']; $url = str_replace("&", "%26", $feed['url']); $url = str_replace("http://", "", htmlspecialchars($url)); echo "<option value=\"$url\">" . $name . "</option>"; } } } echo '</select>'; $options = array(); $rss = $xml->options[0]; if ( strcasecmp($rss['fulltext'],"true") == 0 ) array_push($options, "true"); else array_push($options, "false"); if ( strcasecmp($rss['images'],"true") == 0 ) array_push($options, "true"); else array_push($options, "false"); return $options; } function SetOptions($options) { if ( sizeOf($options) == 2 ) { echo "<script>document.getElementById(\"showtext\").checked = " . $options[0] . ";</script>"; echo "<script>document.getElementById(\"showimages\").checked = " . $options[1] . ";</script>"; } } if ( isset($_GET['links']) ) { $xml = LoadFile($xml_file); if ( $xml == null ) return; // end the link editing return; } ?> <div class="container" id="container_div"> <a name="top"></a> <div class="header_div"> <div style="display:run-in;float:left;"> <font class="graytext">RSS Feed:</font> <?php $options = ShowFeedOptions($feeds_xml); ?> <input type="checkbox" id="showtext" onChange="changeOptions(this)" checked><font class="graytext">Show Full Article Text</font> <input type="checkbox" id="showimages" onChange="changeOptions(this)" checked><font class="graytext">Show Images</font> </div> <?php SetOptions($options); ?> </div> <div class="rss" id="rss_div"> <script>LoadFeed(document.getElementById('rss_feed').value, true);</script> </div> <!-- <p style="padding:0px;margin-right:2px;margin:0px;" align="center"><a class="top" href="#top">Top</a></p> --> </div> <-- CSS BELOW --> Code: body { overflow: auto; font-family: arial; } div.header_div { position: relative; /*background-color: #EFEFEF;*/ width: 100%; overflow: auto; margin: auto; } div.container { /*border: 1px solid black; background-color: #EFEFEF;*/ position: relative; margin: auto; display: block; overflow: auto; /* SPECIFY HEIGHT & WIDTH AS DESIRED */ height: 90%; width: 80%; } div.rss { width: 99%; margin: 2px; background-color: tan; position: relative; /*border: 1px solid black;*/ } img.loading { position: relative; margin-top: 50px; } a.rss_link,a.rss_link:active { display: inline; color: blue; } a.rss_link:hover { color: #BBBBFF; } a.rss_link:visited { color: black; } a.top,a.top:active { text-decoration: none; font-size: 10pt; display: inline; color: black; } a.top:hover { text-decoration: underline; color: brown; display: inline; } font.graytext { font-size: 10pt; color: #444444; } font.rss_title { font-size: 12pt; font-weight: bold; text-decoration: underline; } font.rss_date { font-size: 9pt; font-weight: normal; color: black; display: block; } font.rss_description { font-size: 12pt; color: blue; } select { color: black; font-size: 10pt; background-color: #EAEAEA; } any help would be greatly appreciated.....thanks Hi, So here is my problem. I have a main image that has a bunch of images (e.g., stars) on top. I place the stars in absolute positions on top of the main image. If a user resizes the brower, then the position of the main image changes, so then the stars are off position (not on top of the main image). Should I: 1) make the main image be in an absolute position? or 2) do something else such that the main image moves around if the browser is resized? but then I don't know how to re-adjust the positions of the stars on the fly. Heya peeps So I'm in the process of building a website where audio can be purchased and downloaded. I want each file to allow a preview, but would rather the preview occur on the same page, rather than load up a blank page with a quicktime plugin splodged in the middle. Is there a way of doing it? All I want is a basic play/pause/stop button. To control a piece of sound. Thanks Hi, excuse I'm not a js coder..I need to control the end of a gallery made with mootools and noobslide (http://www.efectorelativo.net/laboratory/noobSlide/). I need the autoplay gallery to end in another way: Solution 1(difficult): After the last image, the gallery starts again from the first image without that "backward" effect. I'd like the first image to be placed after the last one, so the gallery loops without let the user know that it is starting again Solution 2 (easy, I suppose) : gallery stops at the last image Please HELP ME!! TY Hello, I have a slide some on my page which contains some images. It scrolls through images fine but i would like to add some control buttons such as pause/play and scroll back Can anyone tell me how i could do this? i have inc my code cheers Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script type="text/javascript"> var image1=new Image() image1.src="image1.jpg" var image2=new Image() image2.src="toy2.jpg" var image3=new Image() image3.src="toy3.jpg" var image4=new Image() image4.src="toy4.jpg" var image5=new Image() image5.src="toy5.jpg" </script> </head> <style> body { background-image:url('logo2008.jpg'); } .boxed { position:absolute; left:25%; border: 2px black; border-style: plain; width: 700px; height: 800px; } .boxed1 { position:absolute; left:25%; border: 1px blue; border-style: dotted; width: 700px; height: 350px; text-align:center; float: left; padding:2px; background-color: white; } .image { border: 1px blue solid; width: 200px; height:100px; } .image1 { border: 1px blue solid; width: 200px; height:100px; float:left; } .image2 { border: 1px blue solid; width: 200px; height:100px; float:right; } .image3 { border: 1px blue solid; width: 200px; height:100px; } .gallerycontainer{ position: relative; /*Add a height attribute and set to largest image's height to prevent overlaying*/ } .thumbnail img{ border: 1px solid white; margin: 0 5px 5px 0; } .thumbnail:hover{ background-color: transparent; } .thumbnail:hover img{ border: 1px solid blue; } .thumbnail span{ /*CSS for enlarged image*/ position: absolute; background-color: white; padding: 3px; left: -1000px; border: 0px; visibility: hidden; color: blue; text-decoration: none; } .thumbnail span img{ /*CSS for enlarged image*/ border-width: 0; padding: 1px; } .thumbnail:hover span{ /*CSS for enlarged image*/ visibility: visible; top: 400px; left: 500px; /*position where enlarged image should offset horizontally */ z-index: 50; } </style> <body> <a href="javascript:slidelink()"> <div class="boxed1"> <img src="image1.jpg" name="slide" border="0"width="35%" height="100%" /> </div> </a> <div class="image"> <a class="thumbnail" href="#thumb"><img src="360s.jpg" width="198px" height="98px" border="0" /><span><img src="360s.jpg" /><br />Xbox 360 Slim</span></a> </div> <div class="image"> <a class="thumbnail" href="#thumb"><img src="ps3.jpg" width="198px" height="98px" border="0" /><span><img src="ps3.jpg" /><br />Play station 3.</span></a> </div> <div class="image"> <a class="thumbnail" href="#thumb"><img src="wii.jpg" width="198px" height="98px" border="0" /><span><img src="wii.jpg" /><br />Nintendo Wii</span></a> </div> <br> <br> </br> <div class="image"> <a class="thumbnail" href="#thumb"><img src="tv1.jpg" width="198px" height="98px" border="0" /><span><img src="tv1.jpg" /><br />Sony Bravia KDL-40W2000</span></a> </div> <div class="image"> <a class="thumbnail" href="#thumb"><img src="tv2.jpg" width="198px" height="98px" border="0" /><span><img src="tv2.jpg" /><br />Toshiba Regza AV61 (32AV615DB)</span></a> </div> <div class="image"> <a class="thumbnail" href="#thumb"><img src="tv3.jpg" width="198px" height="98px" border="0" /><span><img src="tv3.jpg" /><br />Samsung B550 (LE40B550)</span></a> </div> <br> <br> </br> <div class="image1"> <a class="thumbnail" href="#thumb"><img src="ttg.jpg" width="198px" height="98px" border="0" /><span><img src="ttg.jpg" /><br />Tom Tom GO</span></a> </div> <div class="image1"> <a class="thumbnail" href="#thumb"><img src="sat2.jpg" width="198px" height="98px" border="0" /><span><img src="sat2.jpg" /><br />Garmin nuvi 3790T</span></a> </div> <div class="image1"> <a class="thumbnail" href="#thumb"><img src="sat3.jpg" width="198px" height="98px" border="0" /><span><img src="sat3.jpg" /><br />Navigon 8450 Live</span></a> </div> <br> <br> </br> <div class="image2"> <a class="thumbnail" href="#thumb"><img src="iphone.jpg" width="198px" height="98px" border="0" /><span><img src="iphone.jpg" /><br />iPhone 4</span></a> </div> <div class="image2"> <a class="thumbnail" href="#thumb"><img src="bbt.jpg" width="198px" height="98px" border="0" /><span><img src="bbt.jpg" /><br />Blackberry torch</span></a> </div> <div class="image2"> <a class="thumbnail" href="#thumb"><img src="gphone.jpg" width="198px" height="98px" border="0" /><span><img src="gphone.jpg" /><br />google HTC phone</span></a> </div> <br> <br> </br> <div class="image3"> <a class="thumbnail" href="#thumb"><img src="cod.jpg" width="198px" height="98px" border="0" /><span><img src="cod.jpg" /><br />Call of duty: Black ops</span></a> </div> <div class="image3"> <a class="thumbnail" href="#thumb"><img src="fifa.jpg" width="198px" height="98px" border="0" /><span><img src="fifa.jpg" /><br />Fifa 2011</span></a> </div> <div class="image3"> <a class="thumbnail" href="#thumb"><img src="f1.jpg" width="198px" height="98px" border="0" /><span><img src="f1.jpg" /><br />Formula 1 2010</span></a> </div> <br> <br> </br> <script type="text/javascript"> <!-- var step=1 var whichimage=1 function slideit(){ if (!document.images) return document.images.slide.src=eval("image"+step+".src") whichimage=step if (step<5) step++ else step=1 setTimeout("slideit()",4000) } slideit() function slidelink(){ if (whichimage==1) window.location="image1.jpg" else if (whichimage==2) window.location="toy2.jpg" else if (whichimage==3) window.location="toy3.jpg" else if (whichimage==4) window.location="toy4.jpg" else if (whichimage==5) window.location="toy5.jpg" } //--> </script> </body> </html> Hi guys, I am able to create some of the dynamic controls but having trouble to order them in one column.. i have this view : field1 field2 field3 what i want is : field1 field2 field3 below is my code : function AddLevel2() { //var mainContainer2 = document.getElementById('mainContainer2'); var newDiv = document.createElement('div') newDiv.style.width = "560px"; newDiv.style.backgroundColor= projbgGr; newDiv.style.position = "relative"; newDiv.style.left = "245px"; var BUDDL = document.createElement('select'); // size lenght of the DDL for both IE or Firefox BUDDL.setAttribute("style","width:100px"); //firefox BUDDL.setAttribute("width","100px"); BUDDL.style.width = "100px"; BUDDL.id = 'BU' + b ; BUDDL.setAttribute('name','BU' + b); BUDDL.style.position = "relative"; BUDDL.style.left = "5px"; BUDDL.onchange=show; // filling the DDL by ITEM array Elements var i=0; for (i=0;i<=4;i++) { objOption = document.createElement('option') objOption.text = "BU" + i; //objOption.value=ITEM1[i]; BUDDL.options.add(objOption); } var j =1; var bgc = "##C8BBD0" //mauve light ; //"##D4F1B9" green light; //"##b2d47e"; //add Description Unit Description = document.createElement( 'INPUT' ); Description.id = 'D' + b ; Description.setAttribute('name','D' + b); Description.size=2; // size lenght of the Comment for both IE or Firefox Description.setAttribute("style","width:300px"); //firefox Description.setAttribute("width","300px"); Description.style.width = "300px"; Description.onblur = show; //Description.style.backgroundColor= bgc; //end Description //number of testers NumberTesters = document.createElement( 'INPUT' ); NumberTesters.id = 'T' + b; NumberTesters.setAttribute('name','T' + b ); NumberTesters.size=2; // size lenght of the Comment for both IE or Firefox NumberTesters.setAttribute("style","width:40px"); //firefox NumberTesters.setAttribute("width","40px"); NumberTesters.style.width = "40px"; NumberTesters.onblur=show; //NumberTesters.style.backgroundColor= bgc; //number of testers // Create buttons for creating and removing inputs var newAddButton = document.createElement('input'); newAddButton.type = "button"; newAddButton.value = " + "; var newDelButton = document.createElement('input'); newDelButton.type = "button"; newDelButton.value = " - "; newDelButton.style.position = "relative"; newDelButton.style.left = "7px"; // Append new text input to the newDiv newDiv.appendChild(BUDDL); newDiv.appendChild(Description); newDiv.appendChild(NumberTesters); newDiv.appendChild(newDelButton); //newDiv.appendChild(newAddButton2); //Append newDiv input to the mainContainer div mainContainer.appendChild(newDiv); //Add a handler to button for deleting the newDiv from the mainContainer newAddButton.onclick = AddLevel22; //newAddButton.onclick = AddNewRecord; //newAddButton2.onclick = AddLevel3; newDelButton.onclick = function() { var answer = confirm ("You have to delete all UATs under this BU first\n \tIs this done ?\t") if (answer) {alert ("Now you can delete it"); mainContainer.removeChild(newDiv);} else alert ("Then please check all UATs under this BU first and delete them"); } b++; document.form1.NumberOfBU.value = parseInt(b-1); //alert(document.form1.NumberOfBU.value); //AddLevel3; for (UATCounter = 1 ; UATCounter<=limit; UATCounter++) { //var newDiv = document.createElement('div') // // newDiv.style.width = "250px"; // newDiv.style.backgroundColor= projbgVi; // newDiv.style.position = "relative"; // newDiv.style.left = "350px"; var bgc = "##C8BBD0" //mauve light ; //"##D4F1B9" green light; //"##b2d47e"; newMDate = document.createElement( 'INPUT' ); newMDate.id = 'M'+ (b-1) + '_' + UATCounter ; newMDate.setAttribute('name','M'+ (b-1) + '_' + UATCounter); newMDate.setAttribute('type', 'Date'); newMDate.size=7; newMDate.style.backgroundColor= bgc; //newMDate.onfocus=Calend; // function Calend () // { // fnInitCalendar(this, this.getAttribute('id'), 'style=calendar.css,close=true'); // } newMDate.onblur = show; //Frontline Hours FLHours = document.createElement( 'INPUT' ); FLHours.id = 'FL'+ (b-1) + '_' + UATCounter ; FLHours.setAttribute('name', 'FL'+ (b-1) + '_' + UATCounter); FLHours.size=2; // size lenght of the Comment for both IE or Firefox FLHours.setAttribute("style","width:40px"); //firefox FLHours.setAttribute("width","40px"); FLHours.style.width = "40px"; //NumberTesters.style.backgroundColor= bgc; //Frontline Hours MGRHours = document.createElement( 'INPUT' ); MGRHours.id = 'MG'+ (b-1) + '_' + UATCounter ; MGRHours.setAttribute('name', 'MG'+ (b-1) + '_' + UATCounter); MGRHours.size=2; // size lenght of the Comment for both IE or Firefox MGRHours.setAttribute("style","width:40px"); //firefox MGRHours.setAttribute("width","40px"); MGRHours.style.width = "40px"; //NumberTesters.style.backgroundColor= bgc; //Frontlne Hours //Create buttons for creating and removing inputs var newAddButton = document.createElement('input'); newAddButton.type = "button"; newAddButton.value = " + "; var newDelButton = document.createElement('input'); newDelButton.type = "button"; newDelButton.value = " - "; newDelButton.style.position = "relative"; newDelButton.style.left = "7px"; //newDiv.appendChild(ProjDDL3); newDiv.appendChild(newMDate); newDiv.appendChild(FLHours); newDiv.appendChild(MGRHours); mainContainer.appendChild(newDiv); } } Hello all, I am currently working on a site for a friend and have reached a navigational problem I cannot figure out how to achieve... He has a list of products that link to relevant individual pages which also have next and previous buttons to browse all the product pages on the site (only 10 so no big deal). However, he wants to add additional lists that recommend products by category preference? So for example; 4 products may appeal to a particular category, but when you click the link to view one of the products shown the next and previous buttons scroll through the entire products pages! and not only the ones recommended?? IS it possible using Javascript to define which pages are linked to as next previous without having to create lots more html copies of content pages? I have a basic knowledge of Javascript but cannot find a workable answer or example using google. Any help would be much appreciated. Thanks in advance... Hello, I'm trying to make a slide show for a website that has simple controls on it. I've attached this example so you can see what i mean.... http://www.bigw.com.au/bigw/home.jsp As you can see they use 3 images, and they have controls to go between images easily. Can someone please help me with this code urgently?? Thanks, S. I am brand new to Javascript, have been studying on Lynda.com for almost a week trying to get the hang. I found a cool scrolling effect with controls here at the very bottom of the page, and have built a page just trying to duplicate the html and js below. Unfortunately, it doesn't work. The CSS seems to be there, however no scrolling, any help would be greatly appreciated. PHP Code: <title>Untitled Document</title> <style type="text/css"> #footersponsors ul { list-style-type:none; } #footersponsors { float:left; padding-top:5px; position:relative; width:980px; } #footersponsors #buttons { border:1px solid #777777; margin-bottom:5px; width:955px; } #footersponsors #buttons a { color:#6699CC; margin:10px; } #footersponsors .prev { float:left; } #footersponsors .next { float:right; } #footersponsors .prev img { border:0 none; padding-top:30px; text-decoration:none; } #footersponsors .next img { border:0 none; padding-top:30px; text-decoration:none; } #footersponsorsitems { float:left; margin-left:9px; overflow:hidden; width:895px; } #footersponsorsitems ul { padding-left:2px; width:3900px; } #footersponsorsitems li { float:left; height:90px; line-height:90px; margin:0 2px; width:179px; } </style> </head> <script type="text/javascript" language="javascript"> <!-- jQuery.easing.easeOutQuart = function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }; jQuery().ready(function() { var intval = 2600;//how often to autoscroll (in milliseconds) - This is set with a var to enable trigger functions below jQuery('#footersponsorsitems').serialScroll( { items:'li', prev:'#footersponsors a.prev', next:'#footersponsors a.next', start:0, duration:700, force:true, stop:true, lock:false, interval:intval, //autoscroll set here cycle:true, //pull back once you reach the end easing:'easeOutQuart', //use this easing equation for a funny effect jump: false, //click on the images to scroll to them exclude: 4 //stop scrolling when there are 4 items left as not to pull the others off the screen }); $('#footersponsorsitems').hover(function(){ $(this).trigger('stop'); },function(){ $(this).trigger('start'); }); $('#footersponsorsitems li').hover( function(){ $(this) .stop() .fadeTo(250, 1.0) .siblings() .stop() .fadeTo(500, 0.15); }, function(){ $('#footersponsorsitems li') .stop() .fadeTo(500, 1.0); }); }); // --> </script> <div id="footersponsors"> <input type="hidden" name="ctl26$hfCurrentPage" id="ctl26_hfCurrentPage" value="0" /> <a class="prev" href="#"><img src="/images/buttons/sponsor_select_left_off.gif" alt="<"></a> <div id="footersponsorsitems"> <ul id="ctl26_ulFooterSponsors" style="width:13725px;"> <li><a href="http://www.nhra.com/points/kn-horsepower.aspx" title="" target="_blank"><img src="/assets/footersponsor/KN-HorsePowerChallenge_4c1.gif" alt="" /></a></li> <li><a href="http://www.nhra.com/streetlegal/default.aspx" title="Street Legal Drags" target="_blank"><img src="/assets/footersponsor/NHRA_StreetLegal.gif" alt="Street Legal Drags" /></a></li> <li><a href="http://www.promodchallenge.com/" title="" target="_blank"><img src="/assets/footersponsor/promod.gif" alt="" /></a></li> <li><a href="http://www.nhra.net/yes/" title="Youth and Education Services" target="_blank"><img src="/assets/footersponsor/YESarmy_20th.gif" alt="Youth and Education Services" /></a></li> <li><a href="http://www.coca-cola.com/" title="Coke" target="_blank"><img src="/assets/footersponsor/Coke-official1.gif" alt="Coke" /></a></li> <li><a href="http://www.dasani.com/" title="Dasani" target="_blank"><img src="/assets/footersponsor/Dasani-official.gif" alt="Dasani" /></a></li> <li><a href="http://www.fullthrottleenergy.com/" title="Full Throttle" target="_blank"><img src="/assets/footersponsor/Full-Throttle-Official.gif" alt="Full Throttle" /></a></li> <li><a href="http://www.powerade.com/" title="POWERade" target="_blank"><img src="/assets/footersponsor/Powerade-official.gif" alt="POWERade" /></a></li> <li><a href="http://www.budweiser.com/" title="Budweiser" target="_blank"><img src="/assets/footersponsor/Bud-official.gif" alt="Budweiser" /></a></li> <li><a href="http://www.cat.com/" title="" target="_blank"><img src="/assets/footersponsor/Cat_official.gif" alt="" /></a></li> <li><a href="http://www.fordracing.com/" title="" target="_blank"><img src="/assets/footersponsor/ford1.gif" alt="" /></a></li> <li><a href="http://www.fram.com/" title="Fram" target="_blank"><img src="/assets/footersponsor/FRAM--Official.gif" alt="Fram" /></a></li> <li><a href="http://www.goodyeartires.com/" title="Goodyear" target="_blank"><img src="/assets/footersponsor/Goodyear_Official_4c.gif" alt="Goodyear" /></a></li> <li><a href="http://www.harley-davidson.com/" title="Harley-Davidson" target="_blank"><img src="/assets/footersponsor/HarleyOfficial-4c.gif" alt="Harley-Davidson" /></a></li> <li><a href="http://www.hurstjaws.com/" title="Hurst" target="_blank"><img src="/assets/footersponsor/HURST-tool-official.gif" alt="Hurst" /></a></li> <li><a href="http://www.lucasoil.com/" title="Lucas Oil" target="_blank"><img src="/assets/footersponsor/Lucas-official.gif" alt="Lucas Oil" /></a></li> <li><a href="http://www.maingateinc.com/" title="Main Gate" target="_blank"><img src="/assets/footersponsor/Main-Gate-Logo-NHRA.gif" alt="Main Gate" /></a></li> <li><a href="http://www.motel6.com" title="" target="_blank"><img src="/assets/footersponsor/Motel-6logo-Official1.gif" alt="" /></a></li> <li><a href="http://www.okuma.com/" title="Okuma" target="_blank"><img src="/assets/footersponsor/OKUMA_rev.gif" alt="Okuma" /></a></li> <li><a href="http://www.prestone.com/" title="Prestone" target="_blank"><img src="/assets/footersponsor/Prestone-official.gif" alt="Prestone" /></a></li> <li><a href="http://www.racingelectronics.com/" title="Racing Electronics" target="_blank"><img src="/assets/footersponsor/RE-official.gif" alt="Racing Electronics" /></a></li> <li><a href="http://www.siouxcitykenworth.com/" title="Sioux City Truck and Trailer" target="_blank"><img src="/assets/footersponsor/Sioux-City-TT.gif" alt="Sioux City Truck and Trailer" /></a></li> <li><a href="http://www.summitracing.com/" title="Summit" target="_blank"><img src="/assets/footersponsor/Summit_Official_4C.gif" alt="Summit" /></a></li> <li><a href="http://www.vpracingfuels.com/" title="VP Racing Fuels" target="_blank"><img src="/assets/footersponsor/VPofficial.gif" alt="VP Racing Fuels" /></a></li> <li><a href="http://www.wyotech.edu/" title="WyoTech" target="_blank"><img src="/assets/footersponsor/WyoTechOfficial_large_4C.gif" alt="WyoTech" /></a></li> <li><a href="http://www.nhra.com/points/kn-horsepower.aspx" title="" target="_blank"><img src="/assets/footersponsor/KN-HorsePowerChallenge_4c1.gif" alt="" /></a></li> <li><a href="http://www.nhra.com/streetlegal/default.aspx" title="Street Legal Drags" target="_blank"><img src="/assets/footersponsor/NHRA_StreetLegal.gif" alt="Street Legal Drags" /></a></li> <li><a href="http://www.promodchallenge.com/" title="" target="_blank"><img src="/assets/footersponsor/promod.gif" alt="" /></a></li> <li><a href="http://www.nhra.net/yes/" title="Youth and Education Services" target="_blank"><img src="/assets/footersponsor/YESarmy_20th.gif" alt="Youth and Education Services" /></a></li> <li><a href="http://www.coca-cola.com/" title="Coke" target="_blank"><img src="/assets/footersponsor/Coke-official1.gif" alt="Coke" /></a></li> <li><a href="http://www.dasani.com/" title="Dasani" target="_blank"><img src="/assets/footersponsor/Dasani-official.gif" alt="Dasani" /></a></li> <li><a href="http://www.fullthrottleenergy.com/" title="Full Throttle" target="_blank"><img src="/assets/footersponsor/Full-Throttle-Official.gif" alt="Full Throttle" /></a></li> <li><a href="http://www.powerade.com/" title="POWERade" target="_blank"><img src="/assets/footersponsor/Powerade-official.gif" alt="POWERade" /></a></li> <li><a href="http://www.budweiser.com/" title="Budweiser" target="_blank"><img src="/assets/footersponsor/Bud-official.gif" alt="Budweiser" /></a></li> <li><a href="http://www.cat.com/" title="" target="_blank"><img src="/assets/footersponsor/Cat_official.gif" alt="" /></a></li> <li><a href="http://www.fordracing.com/" title="" target="_blank"><img src="/assets/footersponsor/ford1.gif" alt="" /></a></li> <li><a href="http://www.fram.com/" title="Fram" target="_blank"><img src="/assets/footersponsor/FRAM--Official.gif" alt="Fram" /></a></li> <li><a href="http://www.goodyeartires.com/" title="Goodyear" target="_blank"><img src="/assets/footersponsor/Goodyear_Official_4c.gif" alt="Goodyear" /></a></li> <li><a href="http://www.harley-davidson.com/" title="Harley-Davidson" target="_blank"><img src="/assets/footersponsor/HarleyOfficial-4c.gif" alt="Harley-Davidson" /></a></li> <li><a href="http://www.hurstjaws.com/" title="Hurst" target="_blank"><img src="/assets/footersponsor/HURST-tool-official.gif" alt="Hurst" /></a></li> <li><a href="http://www.lucasoil.com/" title="Lucas Oil" target="_blank"><img src="/assets/footersponsor/Lucas-official.gif" alt="Lucas Oil" /></a></li> <li><a href="http://www.maingateinc.com/" title="Main Gate" target="_blank"><img src="/assets/footersponsor/Main-Gate-Logo-NHRA.gif" alt="Main Gate" /></a></li> <li><a href="http://www.motel6.com" title="" target="_blank"><img src="/assets/footersponsor/Motel-6logo-Official1.gif" alt="" /></a></li> <li><a href="http://www.okuma.com/" title="Okuma" target="_blank"><img src="/assets/footersponsor/OKUMA_rev.gif" alt="Okuma" /></a></li> <li><a href="http://www.prestone.com/" title="Prestone" target="_blank"><img src="/assets/footersponsor/Prestone-official.gif" alt="Prestone" /></a></li> <li><a href="http://www.racingelectronics.com/" title="Racing Electronics" target="_blank"><img src="/assets/footersponsor/RE-official.gif" alt="Racing Electronics" /></a></li> <li><a href="http://www.siouxcitykenworth.com/" title="Sioux City Truck and Trailer" target="_blank"><img src="/assets/footersponsor/Sioux-City-TT.gif" alt="Sioux City Truck and Trailer" /></a></li> <li><a href="http://www.summitracing.com/" title="Summit" target="_blank"><img src="/assets/footersponsor/Summit_Official_4C.gif" alt="Summit" /></a></li> <li><a href="http://www.vpracingfuels.com/" title="VP Racing Fuels" target="_blank"><img src="/assets/footersponsor/VPofficial.gif" alt="VP Racing Fuels" /></a></li> <li><a href="http://www.wyotech.edu/" title="WyoTech" target="_blank"><img src="/assets/footersponsor/WyoTechOfficial_large_4C.gif" alt="WyoTech" /></a></li> <li><a href="http://www.nhra.com/points/kn-horsepower.aspx" title="" target="_blank"><img src="/assets/footersponsor/KN-HorsePowerChallenge_4c1.gif" alt="" /></a></li> <li><a href="http://www.nhra.com/streetlegal/default.aspx" title="Street Legal Drags" target="_blank"><img src="/assets/footersponsor/NHRA_StreetLegal.gif" alt="Street Legal Drags" /></a></li> <li><a href="http://www.promodchallenge.com/" title="" target="_blank"><img src="/assets/footersponsor/promod.gif" alt="" /></a></li> <li><a href="http://www.nhra.net/yes/" title="Youth and Education Services" target="_blank"><img src="/assets/footersponsor/YESarmy_20th.gif" alt="Youth and Education Services" /></a></li> <li><a href="http://www.coca-cola.com/" title="Coke" target="_blank"><img src="/assets/footersponsor/Coke-official1.gif" alt="Coke" /></a></li> <li><a href="http://www.dasani.com/" title="Dasani" target="_blank"><img src="/assets/footersponsor/Dasani-official.gif" alt="Dasani" /></a></li> <li><a href="http://www.fullthrottleenergy.com/" title="Full Throttle" target="_blank"><img src="/assets/footersponsor/Full-Throttle-Official.gif" alt="Full Throttle" /></a></li> <li><a href="http://www.powerade.com/" title="POWERade" target="_blank"><img src="/assets/footersponsor/Powerade-official.gif" alt="POWERade" /></a></li> <li><a href="http://www.budweiser.com/" title="Budweiser" target="_blank"><img src="/assets/footersponsor/Bud-official.gif" alt="Budweiser" /></a></li> <li><a href="http://www.cat.com/" title="" target="_blank"><img src="/assets/footersponsor/Cat_official.gif" alt="" /></a></li> <li><a href="http://www.fordracing.com/" title="" target="_blank"><img src="/assets/footersponsor/ford1.gif" alt="" /></a></li> <li><a href="http://www.fram.com/" title="Fram" target="_blank"><img src="/assets/footersponsor/FRAM--Official.gif" alt="Fram" /></a></li> <li><a href="http://www.goodyeartires.com/" title="Goodyear" target="_blank"><img src="/assets/footersponsor/Goodyear_Official_4c.gif" alt="Goodyear" /></a></li> <li><a href="http://www.harley-davidson.com/" title="Harley-Davidson" target="_blank"><img src="/assets/footersponsor/HarleyOfficial-4c.gif" alt="Harley-Davidson" /></a></li> <li><a href="http://www.hurstjaws.com/" title="Hurst" target="_blank"><img src="/assets/footersponsor/HURST-tool-official.gif" alt="Hurst" /></a></li> <li><a href="http://www.lucasoil.com/" title="Lucas Oil" target="_blank"><img src="/assets/footersponsor/Lucas-official.gif" alt="Lucas Oil" /></a></li> <li><a href="http://www.maingateinc.com/" title="Main Gate" target="_blank"><img src="/assets/footersponsor/Main-Gate-Logo-NHRA.gif" alt="Main Gate" /></a></li> <li><a href="http://www.motel6.com" title="" target="_blank"><img src="/assets/footersponsor/Motel-6logo-Official1.gif" alt="" /></a></li> <li><a href="http://www.okuma.com/" title="Okuma" target="_blank"><img src="/assets/footersponsor/OKUMA_rev.gif" alt="Okuma" /></a></li> <li><a href="http://www.prestone.com/" title="Prestone" target="_blank"><img src="/assets/footersponsor/Prestone-official.gif" alt="Prestone" /></a></li> <li><a href="http://www.racingelectronics.com/" title="Racing Electronics" target="_blank"><img src="/assets/footersponsor/RE-official.gif" alt="Racing Electronics" /></a></li> <li><a href="http://www.siouxcitykenworth.com/" title="Sioux City Truck and Trailer" target="_blank"><img src="/assets/footersponsor/Sioux-City-TT.gif" alt="Sioux City Truck and Trailer" /></a></li> <li><a href="http://www.summitracing.com/" title="Summit" target="_blank"><img src="/assets/footersponsor/Summit_Official_4C.gif" alt="Summit" /></a></li> <li><a href="http://www.vpracingfuels.com/" title="VP Racing Fuels" target="_blank"><img src="/assets/footersponsor/VPofficial.gif" alt="VP Racing Fuels" /></a></li> <li><a href="http://www.wyotech.edu/" title="WyoTech" target="_blank"><img src="/assets/footersponsor/WyoTechOfficial_large_4C.gif" alt="WyoTech" /></a></li> </ul> </div> <a class="next" href="#"><img src="/images/buttons/sponsor_select_right_off.gif" alt=" />"></a> </div> </div> </body> </html> I have just about every thing all set up on my blog now just the way I like it but a few bits of code are not working exactly like I'd want them to. I have a blog: http://thezombiesurvivalist.tumblr.com/ which is using this js: http://static.tumblr.com/ur6r7hb/FoY...ider-jquery.js to allow the mousewheel to scroll the screen right and left rather than up and down. I think the mouse wheel code would all just be in this part: Code: (function($) { var types = ['DOMMouseScroll', 'mousewheel']; $.event.special.mousewheel = { setup: function() { if (this.addEventListener){for(var i=types.length;i;){this.addEventListener(types[--i], handler, false );}} else {this.onmousewheel = handler;} }, teardown: function() { if (this.removeEventListener ) for ( var i=types.length; i; ){{this.removeEventListener(types[--i],handler,false);}} else{this.onmousewheel = null;} } }; $.fn.extend({ mousewheel: function(fn) {return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");}, unmousewheel: function(fn) {return this.unbind("mousewheel", fn);} }); function handler(event) { var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true; event = $.event.fix(event || window.event); event.type = "mousewheel"; if ( event.wheelDelta ) delta = event.wheelDelta/120; if ( event.detail ) delta = -event.detail/3; // Add events and delta to the front of the arguments args.unshift(event, delta); return $.event.handle.apply(this, args); } })(jQuery); I would like the js to force vertical scrolling to be default first, then if then is no vertical scrolling or if it runs out then the horizontal scrolling takes over. Currently it seems to occur in reverse order. For example if you go to one of the posts individual pages that are long: http://thezombiesurvivalist.tumblr.c...esh-in-n-y-l-a then it will scroll left and right before scrolling up and down. I'd rather it be the other way around. Is this code able to be changed to accommodate my desires? Hey everyone, I've looked around quite a bit and can't seem to find anything but I was wondering if there is some open source software offering a text editor/input field similar to the one used on this forum when submitting a comment or thread? Where you can click a bold button or Italic button or URL button to structure it? Thanks Josh Hello, Is there any way I can prevent IE from displaying the "active X controls and script prevention message" when I load my web page into the browser. Firefox, Safari and Chrome, allow my scripts to run without displaying the message when the page is loaded into the respective browsers. Any tips would be really useful. Many thanks Nonye Hi, I need to change the background and the header of a website on which i display ads (by an adserver) It works with this code : <script type="text/javascript"> parent.document.getElementsByTagName("body")[0].style.backgroundImage="url(http://example.jpg)"; parent.document.getElementsByTagName("body")[0].style.backgroundPosition="center 0"; parent.document.getElementsByTagName("body")[0].style.backgroundRepeat="no-repeat"; parent.document.getElementsByTagName("body")[0].style.backgroundColor = "#85bc21"; parent.document.getElementById("header").style.backgroundImage="url(http://example.jpg)"; </script> But i need those elements become clickable. Have you any solutions ? Thanks a lot. Sorry for my %"*!?& english Benoo I have a situation in which I have to track clicks (links etc..). The problem is, I have a larger div ie - parentDiv - like 300px height, 400px width - approximate. This div has a background image. Now, the issue arises because over this div (parentDiv), I have another div "announceDiv" on top of it showing information. I ONLY want the parts of parentDiv that is NOT covered by announceDiv to be clickable. Just to reiterate, I have a big div that I want clickable (so I can add a link to the click), but over this big div I have a smaller div showing content ie, information, that links to its own stuff. BUT I want to be able to link from this background image that is in the parentDi without affecting when I click in the smaller div that is superimposed over it. any ideas? has to work in ie6+ and ff 3+ I have a "button" that calls formA, which in turns calls formB, all done through javascript. As a button: Code: <input type="button" value="Preview" onClick="popupform();"> works perfectly. Of course the user doesn't want some ugly standard button. They want this beautiful image to show instead (personally, I think the .gif they made looks like barf, but that's besides the point...sorry). When I substitute Code: <input type="image" src="/preview/preview_button.gif" name-"preview" alt="Preview Your Item" border="0" onClick="popupform();"> everything works as it should, except the original form, the one that has the button/image on it, becomes a 404 Object not found. The popupform() sets a bunch of cookies, and calls formB. FormB is a .php which reads the cookies and does some other stuff. Not that it should matter, but I am running everything locally in Vista using the XAMPP Apache Friends Edition and going through localhost (because formB is a .php) Thanks in advance. I have created this svg color picker : Edit fiddle - JSFiddle I want that each color can be clicked and if each of them clicked, it will rotate the selected image to the top while the rest of the color will be moved accordingly clockwise (like a wheel). |