JavaScript - Trying To Modify This Slideshow To Enable The Pictures To Be Hyperlinks
I have been using this sideshow example which works great but I want to be able to click on the slideshow picture to take me to another link (hyperlink)
I also wanted to have links next to the slidehsow which would go to a certain picture in the slideshow for example by pressing link "go to picture 3" it would scroll automatically to picture 3 in the slideshow I have been using examples from: http://www.dynamicdrive.com/dynamici...nslideshow.htm this but I am willing to change to another version if I can't do that with this slideshow scrit Similar TutorialsI have been trying to develop a script that creates a slideshow that adds hyperlinks to the images. I'm a beginner at Javascript, so I've made a bastardisation of 3 different scripts I've found that, by my reckoning, should work. This is the slideshow code: Code: window.onload = initAll; var gallery_url = new Array('<a href="http://www.optionstradingaustralia.com.au" target=_blank>', '<a href="http://home.iprimus.com.au/thebyrnes5/splats/index.html">') var thisUrl = 0; var gallery = new Array("portfolio_ota.jpg", "portfolio_bashbrothers.jpg"); var thisImage = 0; var gallery_title = new Array("Options Trading Australia Website", "The Bash Brothers Website"); var thisTitle = 0; var gallery_number = new Array("1", "2"); var thisNumber = 0; function initAll() { document.getElementById("previous").onclick = processPrevious; document.getElementById("next").onclick = processNext; } function processPrevious () { if (thisUrl == 0) { thisUrl = gallery_url.length; } thisImage--; document.getElementById("view_portfolio").src = gallery_url[thisUrl]+'<img src="'+thisImage+'"></a>'; document.getElementById("portfolio_title").innerHTML = gallery_title[thisUrl]; document.getElementById("portfolio_number").innerHTML = gallery_number[thisUrl]; return false; } function processNext () { thisImage++; if (thisUrl == gallery_url.length) { thisUrl = 0; } document.getElementById("view_portfolio").src = gallery_url[thisUrl]+'<img src="'+thisImage+'"></a>'; document.getElementById("portfolio_title").innerHTML = gallery_title[thisUrl]; document.getElementById("portfolio_number").innerHTML = gallery_number[thisUrl]; return false; } I know that for the most part, this script works. It was only when I tried to add the component that involved adding a hyperlink that it broke. The bit of code in the HTML that it directly affects is <div id="view_portfolio"> </div> Does anyone know why the javascript doesn't work? I have a feeling it's because I haven't applied the id tag in the HTML properly, but I don't know what exactly is wrong about it. I am hoping someone here can shed some light on the situation! The gallery I have made so far is at http://www.clarebyrnedesign.com.au/portfolio.html, except that at the moment, the images don't show. I've attached the javascript & html code. Thanks! Following are my script to toggle b/w two different links, <html lang="en-US"> <head> <title>toggle b/w 2 different links</title> <script type="text/javascript"><!-- display=1; function displayvalue() { document.getElementById("sv1").style.display = "block"; document.getElementById("dw1").style.display = "none"; } function ShowHide() { if (display==1) { document.getElementById("sv1").style.display = "none"; document.getElementById("dw1").style.display = "block"; //document.getElementById('javaFun') calling java func from javascript display=2; } else { document.getElementById("sv1").style.display = "block"; document.getElementById("dw1").style.display = "none"; //document.getElementById('javaFun1') calling java func from javascript display=1; } } function Func1Delay() { document.getElementById("sv1").style.display = "none"; document.getElementById("loadimage").innerHTML="<input type='image' src='Loading.gif'>"; setTimeout("LoadImage()", 300); } function LoadImage() { document.getElementById("loadimage").innerHTML=""; ShowHide(); } --></script> </head> <body background="GsNJNwuI-UM.gif"onload="displayvalue()"> <div id="sv1" > <a onclick ="Func1Delay()" href="javascript:;">click me</a> </div> <div id="loadimage"></div> <div id="dw1" > <a onclick ="ShowHide()" href="javascript:;">Download me</a> </div> </body> </html> whenever we call a java method , (consider this line:- document.getElementById('javaFun');)after the completion of java call the page is reloading, how control this reloading after the server completing the request....? can we enable javascript through code
I am trying to make it so if a PHP session entity exists, then JavaScript will enable a button. I am having trouble getting this to work and wondering if anyone knows what I am doing wrong? Code: function purchaseEnable() { if ($_SESSION['order']['paymentmethod']) { document.getElementById("purchase").disabled = false; } } Code: <INPUT disabled id="purchase" type="submit" value="PURCHASE"> I am working with an InDesign CS3 document, with multiple books, and what I want to do is search for a string and turn that string or some how attach an InDesign Hyperlink object to that string. I can find the string using the findText() method var myFoundItems = app.documents.item(0).findText(); And it is returned as a TextStyleRange with its parent being a Story object. What I'm having trouble with is either replacing or attaching a Hyperlink object to string or TextStyleRange. Hyperlink objects to not have a contructor so I don't know how to instantiate a new one and once I get a new one created and the fields populated I don't know how to replace or attach the Hyperlink to that TextStyleRange. I'm new to programming, Here's my problem: I'm using a for loop to generate a list of hyperlinks for(i = 100; i < 200; i++) { var str = "link"; document.write(str.link('http://someWebsite.com/' + i +'.html')); document.write("<br />"); } so the list that is generated looks like... link link link ---------and so on until the loop is finished. My question: is it possible for each links text to be dependent on the pages title? for example instead of the the text "link", the program would follow the URL and know in the pages header was the title "Bob's website" or whatever the pages title was and would generate the list. Example: bobs website daves website rons website susies website betsys website ______________________________ Any help to differentiate the links text based on following the URL would be helpful Thank you! I have a website, and I'[m learning Javascript. Somehow, I have to type a code in my browser like this javascript:enable:_Path Or something to enable the text box so that I can enter in it. Here is the details that I'm given. This below is in the actual website with the text box disabled ( cannot enter anything in it ) Code: <td width="40%"><strong><script>document.writeln(read_str("virtual_media", "STR_VM_CDROM_IMG_PATH"));</script></strong></td> <td><input type="text" id="_path" maxlength="128" disabled style="width:140px;" /> <label id="desc" style="font-size:11px"><script>document.writeln(read_str("virtual_media", "STR_VM_CDROM_IMG_PATH_DESC"));</script></label> </td> Below is me using Google Chrome to inspect the element, the text box. shareHost=document.getElementById("_shareHost"); path=document.getElementById("_path"); user=document.getElementById("_user"); pwd=document.getElementById("_pwd"); CheckRole(); So what do I type in the URL of my broswer to activate the _path form? Do I type javascript:document.getElementById("_path) OR ("path) IF I'm wrong, correct me the way I should do it. If theirs a program that allows me to do it easier, let me know. i am making a registration page for my website and for validation using javascript...is there any way to know on my client side javascript enable or not....
Hello, I am trying to write a piece of code which re enables ctrl c and ctrl v on a paticular page. Here is the source: Code: function disableKeys() { switch ( event.keyCode ) { case 88: //Capture X case 67: //Capture C case 86: //Capture V case 65: //Capture A case 70: //Capture F case 83: //Capture S case 69: //Capture E case 73: //Capture I case 72: //Capture H if (window.event.ctrlKey) { event.cancelBubble = true; event.keyCode = 578; event.returnValue = false; } break; } } I'm sorry I'm not very familiar with html. I figured I could just change the returnvalue to true but it didn't seem to work. hi again i have form with name age payment mode ( combo boxe include payment mode 1,payment mode 2 , payment mode 3) when i select a payment mode-01 enabbleling 5 combo boxes if slect payment mode 2 dissabling that combo boxes... how do i do this thing plzz give me sample code...................... Title really say it all.. How would i enable colours within a text box? :$ Hi I have a form where I want to force users to accept terms and conditions before they can move on to the next page (submit form). Code: <input tabindex="2" name="agreement" id="agreement" type="checkbox" value="N" onchange="checkAgreement()" /> <label class="checking" for="agreement">I accept the <a tabindex="1" href="?page_id=292" title="read this before you continue" class="popmeup">terms and conditions</a>.</label> <!-- the button to be enabled --> <input tabindex="3" type="button" name="confirmer" value="Confirm" onclick="confirmOrder()" disabled="disabled" /> and the JS that works fine in Firefox. IE enables the button, but it still "looks" disabled, hence it is unlikely that anyone clicks it. Code: function checkAgreement() { if(document.order_form.agreement.checked) { document.order_form.confirmer.disabled = false; //document.order_form.submit.disabled = false; document.order_form.agreement0.value = "Y"; //for testing //document.order_form.confirmer.value = document.order_form.agreement0.value; } else { document.order_form.confirmer.disabled = true; //document.order_form.submit.disabled = true; document.order_form.agreement0.value = "N"; //document.order_form.confirmer.value = document.order_form.agreement0.value; } } any ideas? I'm using JavaScript (rssplayer.js) to display a feed from a Blogger blog. I want the feed to be displayed as plain text without the hyperlink to the original posts. Does anyone know how to do this? Thanks rssplayer: http://www.javascriptkit.com/dhtmltu...jaxfeed3.shtml Here's the code in my page: Code: <script type="text/javascript"> //USAGE SYNTAX: new rssdisplayer("divid", "rssurl", numberofitems, "displayoptions") new rssdisplayer("rssdiv", "http://jms8bscience-assignments.blogspot.com/feeds/posts/default?alt=rss", 6, "")</script> Here's the code for the rssdisplayer.js Code: google.load("feeds", "1") //Load Google Ajax Feed API (version 1) function rssdisplayer(divid, url, feedlimit, showoptions){ this.showoptions=showoptions || "" //get string of options to show ("date" and/or "description") var feedpointer=new google.feeds.Feed(url) //create new instance of Google Ajax Feed API feedpointer.setNumEntries(feedlimit) //set number of items to display document.write('<div id="'+divid+'">Loading feed...</div>') this.feedcontainer=document.getElementById(divid) var displayer=this feedpointer.load(function(r){displayer.formatoutput(r)}) //call Feed.load() to retrieve and output RSS feed } rssdisplayer.prototype.formatdate=function(datestr){ var itemdate=new Date(datestr) return "<span style='color:gray; font-size: 90%'>"+itemdate.toLocaleString()+"</span>" } rssdisplayer.prototype.formatoutput=function(result){ if (!result.error){ //if RSS feed successfully fetched var thefeeds=result.feed.entries //get all feed entries as a JSON array var rssoutput="<ul>" for (var i=0; i<thefeeds.length; i++){ //loop through entries var itemtitle="<a href=\"" + thefeeds[i].link + "\">" + thefeeds[i].title + "</a>" var itemdate=/date/i.test(this.showoptions)? this.formatdate(thefeeds[i].publishedDate) : "" var itemdescription=/description/i.test(this.showoptions)? "<br />"+thefeeds[i].content : "" rssoutput+="<li>" + itemtitle + " " + itemdate + itemdescription + "</li>" } rssoutput+="</ul>" this.feedcontainer.innerHTML=rssoutput } else //else, output error alert("Error fetching feeds: "+result.error.message) } //USAGE SYNTAX: new rssdisplayer("divid", "rssurl", numberofitems, "displayoptions") //new rssdisplayer("adiv", "http://www.cssdrive.com/index.php/news/rss_2.0/", 5, "date, description") I need someone who can help me create javascript code which will create a hyperlink string with a changing variable: This script should write and execute a hyperlink string which opens a separate pop-up window, nothing more. No image files, no subfolders, forget all that stuff. JUST A HYPERLINK. The hyperlink SYNTAX does all the work in loading and selecting the images, NOT THE SCRIPT. There is only one changing variable, the value following clipart_id= Here is the basic hyperlink syntax: <a href="http://www.websitename.com/clipart/manipulate? clipart_id= 00000 &path=%2Fclipart%2Feps%2F&lockRatio=true&width=500&height=500"></a> THERE ARE ALWAYS 2 WINDOWS: ONE WINDOW HOLDS THE HTML; THE OTHER IS A POP-UP WINDOW (The opened hyperlink) The basic html page will contain only 2 objects, an input box and a NEXT BUTTON. Step 1: Initialize the variable from an input box, this variable is used to set the value following clipart_id= which is part of the hyperlink syntax Step 2: The user inputs the initial variable which is used to write the first hyperlink string; click NEXT to launch the first pop-up window Step 3: For each subsequent action Click NEXT - OnClick - This ADDS +1 to the initial variable, this variable is passed to be inserted in a new hyperlink string AND then launches a NEW hyperlink to open a NEW popup window. This is an infinite type of action which advances the value of clipart_id= every time the NEXT button is clicked. Each time you click the NEXT button it advances a counter which executes a NEW hyperlink in a NEW popup window. The only thing that ever changes is the variable after clipart_id=, BUT the entire url syntax of the hyperlink string must be maintained exactly as shown below. If you change the syntax it will not work. So, if the first value to start with is lets say 13000 ; this is input in a box; then the first hyperlink string will automatically be written and open using this: <a href="http://www.websitename.com/clipart/manipulate?clipart_id= 13000 &path=%2Fclipart%2Feps%2F&lockRatio=true&width=500&height=500"></a> Click the NEXT BUTTON and now a new hyperlink window will open which reads like this: <a href="http://www.websitename.com/clipart/manipulate?clipart_id= 13001 &path=%2Fclipart%2Feps%2F&lockRatio=true&width=500&height=500"></a> click the NEXT BUTTON and now a new hyperlink hyperlink window will open reads like this: <a href="http://www.websitename.com/clipart/manipulate?clipart_id= 13002 &path=%2Fclipart%2Feps%2F&lockRatio=true&width=500&height=500"></a> And so on and so on... Nothing else changes. So the "nextpath" after a CLICK is a complete new hyperlink string which contains a vew variable for the value following clipart_id= All I am trying to do is execute a standardized hyperlink string with one changing variable. CAN ANYONE HELP ME TO WRITE THIS CODE? hi there, I'm looking for a method to use several hyperlinks to submit a form and then return the page within the link for example Code: <a href="thispage.php?mode=1" Onclick="javascript:form.submit();"> <a href="thispage.php?mode=2" Onclick="javascript:form.submit();"> the reason for this is so that no matter which link a user navigates to the form will be submitted and no data lost. however the above code obviously loses the POST info as the form action will be different from the a tag. Therefore I think maybe a way of creating a variable that changes the form action to match the a link selected (as the form(s) are submitted to the same php page. hope someone can think clearer than me! cheers Hi, I have two buttons save and finish. I want to enable the button finish whenever I click the save button. page1.jsp. <script> InitialLoad() { document.getElementById('finish').disabled = true; } save(){ document.getElementById('finish').disabled = false; } </script> <html> <body onload= "InitialLoad()"> <input type="submit" name="finish" id=="finish" value="finish"> <input type="submit" name="save" value="save" onclick= save();> </body> </html> strutsconfig.xml <forward name="success" path="atre.dodUpgrade.show.page1"/> Using the above I can enable it temporarly. But whenever I call the forward page it on action class forward = mapping.findForward("success"); The Problem is page Refresh again and it shows disabled button for finish. what could be the solution for this? Thanks I want to build functionality like that (see http://www.cymaxstores.com/Common/Pr....aspx?ID=26094) is it possible with only javascript , or ??? I dont have any clue plz help any help would be appreciated Thanks sknaht Dear All I have done some coding in javascript . Where i am generating the textbox field and checkbox dynamicaly . That is as per condition if there is one record match as per condition then that many text field will be generated So just to give a example , which is not dynamical What i want to do is first the text field are disable and when the checkbox is checked then the text box should be enable For 1 record the logic is working proper , but if there are more then 1 record then it does not work Can you'll please help <?php session_start();?> <!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>Untitled Document</title> <link rel="stylesheet" href="../locationpropertydesirecom/css/adcss1.css" type="text/css" media="screen" /> <script language="JavaScript"> function enable_text(status) { status=!status; var e=document.getElementsByTagName("tr"); for(var i=0;i<e.length;i++) { e[i].disabled = status; } } </script> </head> <body> <table> <tr> <td><input type="text" id="aa" name="a" disabled="disabled"/></td> <td><input type="text" id="aa" name="b" disabled="disabled" /></td> <td><input type="checkbox" name="aa" value="check" onclick="enable_text(this.checked)" /> </tr> <tr> <td><input type="text" name="a" disabled="disabled"/></td> <td><input type="text" name="b" disabled="disabled" /></td> <td><input type="checkbox" name="aa" value="check" onclick="enable_text(this.checked)" /> </tr> </table> Thanks , regards Jim Hi there. I came across this forum while searching for an example of how to do something in Javascript, and found the post helpful, but didn't quite answer my query completely... It was a very old thread, few years old, though so I thought best not to revive it from the murky depths Basically, I very rarely use JavaScript... in fact, I rarely do any programming at all, but I'm trying to build a basic site at the moment, and I'm wanting to disable/enable a text box based on the value of a drop down menu... The idea behind it is that I have a sub title, and in the admin panel, I want to be able to set whether the sub title is picked randomly from a database, or whether it chooses one, and only one... So in the admin panel, I've got a page that has a drop down menu with two options. Static, and Random. Below this, I've got a text box called Static ID... In this text box, the administrator would insert the database row ID for the specific sub title they want... Obviously this Static ID field only applies if you select a Static sub title, rather than a Random sub title... So what I want to happen is for the text box to be disabled if the drop down menu is selected as Random... and then enabled if the drop down is selected as Static... So I came across the following script on an old post as mentioned earlier: Code: <script type = "text/javascript"> function enableTextbox() { if (document.getElementById("dropdown").value == "New") { document.getElementById("txt1").disabled = false; } else { document.getElementById("txt1").disabled = true; } } </script> <form action="adm_subtitle.php" method="post"> Static or Random? <select name="staticrand" id"staticrand" onchange="enableTextbox()"> <option value="static">Static</option> <option value="rand selected="selected">Random</option> </select> Static ID <input type="text" value="0" name="staticid" id="staticid" maxlength="3" disabled="true" /> <input type="submit" name="submitsubtitleset" value="Submit" /> </form> With a bit of other formatting that isn't necessary for this example... Now, this works if I change the drop down box to Static, it'll enable the text box, and then disable the text box if I select Random... The problem I've got though, is with a bit of PHP code mixed in with the form, it will check the current value of the setting, and then choose which drop down menu to pick as selected... so if in the backend config it's set to "rand", it'll automatically pick Random when the page loads, and if it's set to "static", it'll automatically pick Static when it loads the page... If it's already set to Static, the page loads and the text box is disabled. I have to select Random from the drop down list, and then select Static again to enable the box... Is there anyway that I can enable it if Static is already selected when the page loads and then disable it when Random is selected, but still keep the functionality that it is already disabled when the Random option is selected on load? I hope that makes sense... Cheers, Mike. hello, i have this script that doesn't work exactly right yet. but i can't figure it out what i need to chance to let it work. in the script i want the button to be enabled when both text boxes are filled, atm when i fill in 1 it will already enable the button and thats exactly what i don't want. im quite a nooby in this so could some1 help me ? tyvm in advance code___________________ <html> </head> <script type="text/javascript"> function ButtonDisable1(text) { if (text.length > 0) document.getElementById("submit_button").disabled = false; else document.getElementById("submit_button").disabled = true; } </script> </head> <body> <input type="text" id="search_text" onchange="ButtonDisable1(this.value)"> <input type="text" id="search2_text" onchange="ButtonDisable1(this.value)"> <input type="submit" id="submit_button" value="Search" disabled="true"> </body> </html> |