JavaScript - I Cant Link Out Of Link Inside Rotating Tabs
Similar TutorialsHello Everyone! There are several other pages over a span of sites that deal with this matter, but none that seem to work for me. So I'm hoping you guys can help. I'm trying to get a set of rotating images to house a set of links that visitors can click on. Here's code I slapped together: Code: <script language="javascript" type="text/javascript"> var imgArray = new Array(); // Enter the names of the images below imgArray[0]="http://www.555.com/file.JPG"; imgArray[1]="http://www.555.com/file.JPG"; imgArray[2]="http://www.555.com/file.JPG"; // Set up URL array var URL = new Array(); URL[0] = "http://www.555.com"; URL[1] = "http://www.555.com"; URL[2] = "http://www.555.com"; var newImage = 0 ; var totalImg = imgArray.length ; var currentURL = (URL.length - 1); function cycleImg() { if (newImage == totalImg) { newImage = 0 ; } else { document.image.src = imgArray[newImage]; document.image.URL = URL[a] ; // set the time below for length of image display // i.e., "4*1000" is 4 seconds setTimeout("cycleImg()", 3*1000); newImage++; } } </script> <body onload="cycleImg();"> <div id="rotator_div"> <p style="text-align:center;"> <strong>Current Sponsors:</strong></p> <img id="rotating_img" src="http://www.555.com/file.JPG" name="image"/> </div> </body> Now it only loads the first image, and disappears; plus the image that does load, doesn't have the corresponding URL attached to it in as a link. Could anyone please help with the adjustments that I need to make to pull this off? Thanks very much in advance. I have an ajax tabbed site which loads the content in the div below it. I made a drop down link so that the user could select one of 3 on one tab but this is outside of the script.js. I'm wondering if there's a way to get the target of these drop down links to open in the div below instead of a new tab? http://voiceprocess.net/script.js <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Home Improvement Survey Process</title> <link href="../../../voiceprocess.ico" rel="shortcut Icon"> <link rel="stylesheet" type="text/css" href="../styles.css" /> <link href="../dropdown.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="script.js"></script> </head> <body> <div id="main" style="float:left"> <table width="991" border="0" cellpadding="0"> <tr> <td width="649"><ul class="tabContainer"> <!-- The jQuery generated tabs go here --> </ul></td> <td width="75" style="padding-bottom:43px"> <div id="centeredmenu" style=" width:0px; height:0px"> <ul > <li style="padding-left:0px"><span class="sears"><a href="#')"> </a></span> <ul style="padding-top:2px"> <span class="space"></span><span class="space"></span> <li><a href="pages/sears_refacing.html" target="_self">Cabinets Refacing</a> <div> <li><a href="pages/sears_hvac.html">HVAC </a></li> <li><a href="pages/sears_windows.html"></a>New Windows </a></li> </ul> </li> </div></td> <td width="241"><a href="upsell.php" target="_blank"><img src="../u.png" alt="" width="26" height="37" border="0" style="padding-bottom:5px"/></a> <a href="../data.html" target="_blank"><img src="../s.png" alt="" width="29" height="37" border="0" style="padding-bottom:5px"/></a><img src="../../../images/logosm.png" alt="" width="158" height="42" hspace="10" /> </td> </tr> </table> <div id="tabContent"> <div id="contentHolder"> <!-- The AJAX fetched content goes here --> </div> </div> </body> </html> in a javascript file that contains the following code, is there a way to hyperlink the word ELEPHANT ? $j('#message').html("white ELEPHANT"); Hi I'm trying to finish integrating my affiliate program and i'm having problems on the last bit.. basically how do i get this to work? basically i need the id token to be displayed... Code: <input name="radiobutton" type="radio" onclick="window.location.href='http://tracking.alpharooms.com/idevaffiliate.php?alpha_id=552&alpha_keyword= <script language="JavaScript" type="text/javascript" src="http://www.theholidaymakers.me.uk/affiliates/display.php?token=id"></script> &alpha_url=http://www.alpharooms.com/cheap-flights.aspx/?cob=64'; " value="radiobutton" /> the display.php file is below PHP Code: <?PHP ############################################################# ## iDevAffiliate Version 5.2 ## Copyright - iDevDirect.com L.L.C. ## Website: [url]http://www.idevdirect.com/[/url] ## Support: [url]http://www.idevsupport.com/[/url] ## Email: [email]support@idevdirect.com[/email] ############################################################# /* -------------------------------------------------------------- You can alter the CSS below but do not remove the Java Script Tags. They are required because this file is being called via Java Script. Any invalid coding adjustments to this page will result in Java Script errors in the page you've placed the Java Script code snippet. Adjustments to this file are not supported by iDevDirect. We highly suggest making a backup of the original display.php file before making changes. If you're wondering what the variable $idev represents, that is the affiliate ID number and is obtained from the /includes/tracking.php file. -------------------------------------------------------------- */ $token_tag_id = ""; $token_tag_username = "Affiliate Username"; $token_tag_phone = "Affiliate Phone"; $token_tag_name = "Affiliate Name"; $token_tag_company = "Affiliate Company"; $token_tag_city = "Affiliate City"; $token_tag_state = "Affiliate State"; $token_tag_zip = "Affiliate Zip Code"; $token_tag_website = "Affiliate Website"; ?> document.write('<style type="text/css">'); document.write('<!--'); document.write('p.idev {'); document.write('font-size: 12px;'); document.write('font-family: Arial, Helvetica, sans-serif;'); document.write('font-weight: bold;'); document.write('}'); document.write('-->'); document.write('</style>'); <?PHP $time_now = time(); include ("API/config.php"); include ("includes/validation_functions.php"); include ("includes/tracking.php"); // SANITIZE AND SET INCOMING TOKEN VARIABLE // ----------------------------------------------------------- $token = check_type('token'); if ($idev) { // GET AFFILIATE DATA // ----------------------------------------------------------- $aff_data = mysql_query("select username, phone, f_name, l_name, company, city, state, zip, url from idevaff_affiliates where id = '$idev'"); if (mysql_num_rows($aff_data)) { $aff_data = mysql_fetch_array($aff_data); $affiliate_username = $aff_data['username']; $affiliate_phone = $aff_data['phone']; $affiliate_fname = $aff_data['f_name']; $affiliate_lname = $aff_data['l_name']; $affiliate_name = $affiliate_fname . " " . $affiliate_lname; $affiliate_company = $aff_data['company']; $affiliate_city = $aff_data['city']; $affiliate_state = $aff_data['state']; $affiliate_zip = $aff_data['zip']; $affiliate_website = $aff_data['url']; } } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE ID // ----------------------------------------------------------- if (($token == 'id') || (!$token)) { if ($idev) // ----------------------------------------------------------- { $token_id = $idev; } else { $token_id = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_id $token_id</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE USERNAME // ----------------------------------------------------------- if ($token == 'username') { if ($idev) // ----------------------------------------------------------- { $token_username = $affiliate_username; } else { $token_username = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_username: $token_username</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE PHONE // ----------------------------------------------------------- if ($token == 'phone') { if (($idev) && ($affiliate_phone)) // ----------------------------------------------------------- { $token_phone = $affiliate_phone; } else { $token_phone = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_phone: $token_phone</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE NAME // ----------------------------------------------------------- if ($token == 'name') { if (($idev) && ($affiliate_name)) // ----------------------------------------------------------- { $token_name = $affiliate_name; } else { $token_name = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_name: $token_name</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE COMPANY // ----------------------------------------------------------- if ($token == 'company') { if (($idev) && ($affiliate_company)) // ----------------------------------------------------------- { $token_company = $affiliate_company; } else { $token_company = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_company: $token_company</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE CITY // ----------------------------------------------------------- if ($token == 'city') { if (($idev) && ($affiliate_city)) // ----------------------------------------------------------- { $token_city = $affiliate_city; } else { $token_city = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_city: $token_city</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE STATE // ----------------------------------------------------------- if ($token == 'state') { if (($idev) && ($affiliate_state)) // ----------------------------------------------------------- { $token_state = $affiliate_state; } else { $token_state = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_state: $token_state</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE ZIP // ----------------------------------------------------------- if ($token == 'zip') { if (($idev) && ($affiliate_zip)) // ----------------------------------------------------------- { $token_zip = $affiliate_zip; } else { $token_zip = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_zip: $token_zip</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE WEBSITE // ----------------------------------------------------------- if ($token == 'website') { if (($idev) && ($affiliate_website) && ($affiliate_website != "http://")) // ----------------------------------------------------------- { $token_website = "<a href=\'$affiliate_website\' target=\'_blank\'>$affiliate_website</a>"; } else { $token_website = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_website: $token_website</p>\");"; } $affiliate_logo = "$logo_default"; // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE LOGO // ----------------------------------------------------------- if ($token == 'logo') { // ----------------------------------------------------------- // GET LOGO/IMAGE DATA // ----------------------------------------------------------- if (isset($idev)) { $logo_data = mysql_query("select filename from idevaff_logos where id = '$idev' and approved = '1'"); if (mysql_num_rows($logo_data)) { $logo_data = mysql_fetch_array($logo_data); $affiliate_logo = $logo_data['filename']; $logo_location = $base_url . "/logos/" . $affiliate_logo; } else { $logo_location = $logo_default; } } // ----------------------------------------------------------- list($width, $height, $type, $attr) = getimagesize("$logo_location"); // ----------------------------------------------------------- print "document.write(\"<img border='0' src='$logo_location' width='$width' height='$height'>\");"; } ?> HELP IS NEEDED, THANKS IN ADVANCE. I am using JavaScript for popups in my OpenLayers map. All the html tags like <br> work in the popup window except for the link href tag. Everytime I put in a link in my popup window it doesnt work: Code: var mystring = "here is link:<br> <a href=\"www.sun.com\">link</a>"; popup = New OpenLayers.Popup.FramedCloud("chck", feature.coord, null, mystring, null, true, onPopupClose); Also tried link without quotes and with ticks and nothing seems to work with the link not taking me anywhere. Please advise. Hi all we are in desperate need of a solution, we have tried and search different methods but none of us can figure it out. Basically we need to find a word which is inside a class and display a link. So something like this find a word equal to "1 line custom" then display this <a href="/1-line-custom.htm">click here</a> I'm not sure if this is really simple or not. Any help would be much appreciated. Thanks Will Hello everyone! First of all let me introduce myself as this is my first post on the coding forums! My name's Tom, I live in Sheffield, England and I'm 21 years old. Anyway, I have a little problem on a project I'm working on. I have a div set with an onclick link (onclick="location.href='http://www.google.com/';"). Thats not the problem, that works fine. The problem I'm having is that I then have another div inside this div that I don't want to be linked at all but the outer div's link seems to still be active on the inner one. Does anyone have any idea how to stop the link on the inner div whilst still keeping the outer div linked? Thanks alot for any help, Regards, Tom. Hello, I REALLY like the dropdown menus that are on the Patagonia website. How difficult would this be to replicate? Is there a write-up or tutorial somewhere I can read and learn how to do this? Any help would be greatly appreciated, Thanks Here is the link: http://www.patagonia.com/web/us/home I'm working on a technical document that has a glossary section. When I use a technical term, I link to its definition in the glossary then provide a return link to return the user to whence they came. But if I use that same term again, and if I want to link it to the glossary, I need to duplicate the glossary entry in order to provide a return link that returns them to the right place. Is there some way I could link them to the glossary and embed a unique return link in the link to the glossary?
Hi, I'm relativly new to JS and brand new to the forum so you might need to dumb down your replys for my slightly lacking knowledge. That being said I do have a very solid grasp of html, css and am getting there with JS and its various frameworks. I'm integrating wordpress into an existing site for a friend and currently have the main blog page appear in a DIV. This is the best way to integrate in this case due to many reasons mostly of way the site is constructed. Code: <div class="scroll-pane" id="scrollbox"> WORDPRESS BLOG </div> My issue is that links within that DIV, in the blog, when clicked redirect the page. The simple answer to this would be to have them just open in a new page, which I can easily do with the below code. Code: function Init() { // Grab the appropriate div theDiv = document.getElementById('scrollbox'); // Grab all of the links inside the div links = theDiv.getElementsByTagName('a'); // Loop through those links and attach the target attribute for (var i=0, len=links.length; i < len; i++) { // the _blank will make the link open in new window links[i].setAttribute('target', '_blank'); } } window.onload = Init; But what I'd rather it do is have any link clicked inside the DIV to reload in that same DIV, similar to an iframe, but obviously without using an iframe, due to it's compatibility issues. Is this possible by editing the above code? If not what do I need? Thanks in advance for any help! I've been using this slidehsow but each time I click on a link (Newsflash) it goes to yahoo.com, even though each link goes to a different website, it looks like the last link of the last slidehsow is the one which controls all the slidehsow links link of slidshow as you can see from the code each link for each slidehsow should go to a diffrent website. Code: <div class="lof-main-outer"> <ul class="lof-main-wapper"> <li> <img src="images/791902news3.jpg" title="Newsflash 2" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 2" href="http://www.google.com">Newsflash 2</a></h3> <p>The one thing about a Web site, it always changes! Joomla! makes it easy to add Articles, content,...</p> </div> </li> <li> <img src="images/435576news10.jpg" title="Newsflash 1" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 1" href="http://www.gmx.com">Newsflash 1</a></h3> <p>Joomla! makes it easy to launch a Web site of any kind. Whether you want a brochure site or you are...</p> </div> </li> <li> <img src="images/641906img1.jpg" title="Newsflash 3" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 3" href="www.godaddy.com">Newsflash 3</a></h3> <p>With a library of thousands of free Extensions, you can add what you need as your site grows. Don't...</p> </div> </li> <li> <img src="images/416719news7.jpg" title="Newsflash 5" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 5" href="http://www.flickr.com">Newsflash 5</a></h3> <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web...</p> </div> </li> <li> <img src="images/416719news7.jpg" title="Newsflash 5" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 5" href="http://www.intel.com">Newsflash 5</a></h3> <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web...</p> </div> </li> <li> <img src="images/416719news7.jpg" title="Newsflash 5" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 5" href="http://www.yahoo.com">Newsflash 5</a></h3> <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web...</p> </div> </li> </ul> </div> Ok so i have wrote some code which can be seen he http://www.runningprofiles.com/members/include/test.php This works great but when i add the code to the page i want it on (include "include/test.php" for some reason the code does not work... the text is delayed and then lags behind the images.. this can been seen here http://www.runningprofiles.com/members/ I have no idea why its happening! Code for the code is Code: <html> <head> <title>http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q__26659912.html</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script> <script type="text/javascript"> function advance() { $("#slideshow").cycle("next"); cycleCaption(); } var displayedIndex = 0 function cycleCaption() { $("#caption").children().each( function(index) { $(this).css("font-weight", (index==displayedIndex)? "bold" : "normal" ); }); displayedIndex = (++displayedIndex==$("#caption").children().length)? 0 : displayedIndex; } $(function() { $("#slideshow").cycle({ timeout: 0 }); $("img").each( function() { $("<div />").html($(this).attr("title")).appendTo($("#caption")); }); cycleCaption(); setInterval( "advance()", 2000 ); }); </script> </head> <body> <div id="slideshow" style="float: left;"> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14882_jruqg6x4uu6frw2g872b.jpg" title="Aisling Cuffe Before Foot Locker" /> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14879_mzcgn05auhs24fnsygc1.jpg" title="Foot Locker Ballerness" /> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14880_u1npsmglw7b9t6hmoqhu.jpg" title="Foot Locker The Rocket" /> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14887_9bblfhhvc0x66vebgjua.jpg" title="NCAA D2 Cro" /> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14884_mud4ewe6uh6ihrrpux6g.jpg" title="NXN Recap and Results" /> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14865_y1kt8vzejkvz25k075x2.jpg" title="Give Your " /> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14877_1mlnygbenofquj5h3mcz.jpg" title="NCAA D2 XC Champ" /> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14855_9g971maove1jyos0h9zk.jpg" title="Defending" /> <img src="http://c0205112.cdn.cloudfiles.rackspacecloud.com/14850_6u22ylfzym7sxq1zw8p8.jpg" title="NXN 121" /> </div> <div id="caption" style="float: left;"> </div> </body> </html> Hi, I have a flash code, I need to add alink in this code, but I don't know how I can. This is the link I want to add " www.baligim.com" Thanks. Code: Code: <div id="wb_Flash1" style="margin:0;padding:0;position:absolute;width:300px;height:60px;text-align:left;z-index:0;"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" <param name="movie" value="http://www.baligim.com/download/reklam-banner.swf"> <embed src="http://www.baligim.com/download/reklam-banner.swf" width="300" height="60"> </embed> </object></div> . I know you may think... why is he doing this? There is a reason, this is just the simplified version. Code: <a href="URL TO COPY" id="COPYME">Next</a> <a href="COPIED URL HERE VIA JAVASCRIPT" >Next</a> Hello and good morning... I am a locking for a script, so i can open this: <div class="topprofile"><a href="index.php?side=editprofile#editpw">Edit password</div> After i have push in this, "topprofile" button, i want to have link like this: http://localhost/index.php?side=editprofile#editpw Can you plaese help me with this one? All, I have a page that has some checkboxes in it. I have the following function for that: Code: function checkbeforesubmit(field) { for (var i = 0; i < field.length; i++){ if(field[i].checked){ // if a field is checked form is submitted alert("You have checkboxes that are selected. Add the photos before you go to the next set of pictures!"); return false; } } return true; // if no fields are checked form not submitted } I then a link to go to the next page and I want to check to see if any checkboxes are selected before I go to the next page. I try and check this by doing this: Code: onClick="checkbeforesubmit(document.photos.elements['picbigid[]'])" It does the check and says that a checkbox is selected but will still go to the next page anyway. How can I stop it from going to the next page? Thanks! Below is a bulleted array, as you can see I inserted the sample url tag but it's not working, is that the wrong location? Code: $catArr = array( 0=>array("category"=>"Banners", "id"=>217, "nav1"=>"Events & Themes", "nav2"=>"", "headerText"=>"<h2>Templates for Full Color Banners</h2><ul><li>Choose your Banner by Event or Theme</li><li>Select a template and make it your own!</li><li>Text Position and Color are for demonstration only.<br/>You may move or change them as needed.</li><br><br> 'url'=>"http://www.google.com", back to main banner page</ul>"), Does anyone know of a safe mailto link using JavaScript?
|