JavaScript - Video Playlist Next And Prev Button
Hi all !
I was searching for this problem over and over in here adn other websites but coudn't find any solution. Ok here is the problem: I made a video playlist in XML. Here is how it looks like: Code: <videotemplate> <videoblock> <video id="1"> <title>test1</title> <src>sd.webm</src> <img>diagnoza.jpg</img> </video> <video id="2"> <title>test2</title> <src>video.webm</src> <img>resident.jpg</img> </video> <video id="3"> <title>test3</title> <src>sd.webm</src> <img>resident.jpg</img> </video> </videoblock> <videoblock> <video id="4"> <title>test4</title> <src>video11.webm</src> <img>resident.jpg</img> </video> <video id="5"> <title>test5</title> <src>video4.webm</src> <img>resident.jpg</img> </video> <video id="6"> <title>test5</title> <src>video5.webm</src> <img>resident.jpg</img> </video> </videotemplate> Them I am using this javascript + XLST to play next file: Code: <script type="text/javascript"> function nextSrc<xsl:value-of select="@id" />() { var myvideo = document.getElementsByTagName('video')[0]; myvideo.src="file://d:/cis/guide/<xsl:value-of select="videoblock/video/following::src" />"; myvideo.load(); } </script> When I use nextSrc function video flips to next xml record with <src> tag but it only does that once! How to make it flip to next video every time ?? Please help ! Similar TutorialsHi there everyone I'm new here and to the world of coding in general. I have my own site now on it's third build. The second build was done by a someone else using ASP and database type things, which I don't really understand. Since I can no longer seem to contact him I'm trying to update the site myself but I'm having some trouble. I have a page on my site which contains a flash video player with and xml based playlist, however when I access this page from my main computer the page produces an error message which reads 'playlist could not be loaded due to cross-domain policy restrictions'. If I add www. to the address then it works fine. I'm unsure of how to rectify this or whether it is a problem for anyone else viewing the site: williammorrismusic.com/video.asp Below is the code I have used for the player: Code: <script type='text/javascript' src='http://www.williammorrismusic.com/swfobject.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> var so = new SWFObject('player.swf','mpl','640','560','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','opaque'); so.addVariable('playlistfile','http://www.williammorrismusic.com/playlist.xml'); so.addVariable('backcolor','000000'); so.addVariable('frontcolor','ffffff'); so.addVariable('lightcolor','ffffff'); so.addVariable('screencolor','000000'); so.addVariable('playlist','bottom'); so.write('mediaspace'); </script> Any help on this would be most appreciated. I've also posted this in the java section I think in error, if it is I apologize and please remove it. Hi there everyone I'm new here and to the world of coding in general. I have my own site now on it's third build. The second build was done by a someone else using ASP and database type things, which I don't really understand. Since I can no longer seem to contact him I'm trying to update the site myself but I'm having some trouble. I have a page on my site which contains a flash video player with and xml based playlist, however when I access this page from my main computer the page produces an error message which reads 'playlist could not be loaded due to cross-domain policy restrictions'. If I add www. to the address then it works fine. I'm unsure of how to rectify this or whether it is a problem for anyone else viewing the site: williammorrismusic.com/video.asp Below is the code I have used for the player: Code: <script type='text/javascript' src='http://www.williammorrismusic.com/swfobject.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> var so = new SWFObject('player.swf','mpl','640','560','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','opaque'); so.addVariable('playlistfile','http://www.williammorrismusic.com/playlist.xml'); so.addVariable('backcolor','000000'); so.addVariable('frontcolor','ffffff'); so.addVariable('lightcolor','ffffff'); so.addVariable('screencolor','000000'); so.addVariable('playlist','bottom'); so.write('mediaspace'); </script> Any help on this would be most appreciated. Hello Everyone, Recently started using JW Player and I am very pleased so far! Did anybody have a script for making a playlist [xml file]. I hope to add java code or script (or html if possible) to play the playlist according to a schedule (year, month, day, hour, minute, second) so that, when a user opens the website, the correct video and, ideally, the correct point within the video, opens up according to the day, hour, and minute that the page is opened. This will give the impression of a "live" or "real time" broadcast. If any body could solve my problem I am very grateful to them. 01) I would like to rollover (onmouseover?) a button that is a video and have the video (button) play. (A 5 sec video that stops at end) 02) On rolloff (onmouseoff?) the same button I would like it to rewind to the beginning for next rollover. 03) I would like to add more of these "Video Button Rollovers" to the same website page in the future. I would like to use DreamWeaver CS4, and stay away from flash for more accessibility and less memory intensive overhead. (obviously no control-bar for video) ----- I have all the parts to this to try a variety of solutions. ----- -The video is a box with untied string on a white background. - When played a person fades-on and ties the string into a bow. (white background matches website background) ----- Parts: 01) video from untied box to tied box with person .mov 02) image of first frame of video .jpg 03) video from untied box to tied box with person to person fade-off and untied box .mov 04) video of tied box with person to person fade-off and untied box.mov ----- The parts will be on this website: http://mydata.salve.edu/emersonb/g2/media.html Thanks Hey folks, I'm really wanting to mess around with doing something like the button at the bottom of this web page: http://www.major-confusion.co.uk/tut...sh-button.html The button has a short looping animation that plays when the button is moused over. It could create a very cool effect. Any JS gurus know if this or something similar can be done using JS and/or html5? I'm trying to avoid using flash at all costs. Thanks in advance. I followed a tutorial on Lynda for a simple HTML5 slideshow and altered it so that it doesn't auto play and has next and previous button controls. I can't quite figure out the previous button. Code: </script> <script type="text/javascript"> var imagePaths = [ "images/Test-1.jpg", "images/Test-2.jpg", "images/Test-3.jpg", "images/Test-4.jpg" ]; var showCanvas = null; var showCanvasCtx = null; var img = document.createElement("img"); var currentImage = 1; window.onload = function () { showCanvas = document.getElementById('showCanvas'); showCanvasCtx = showCanvas.getContext('2d'); img.setAttribute('width','480'); img.setAttribute('height','360'); } function nextImage() { img.setAttribute('src',imagePaths[currentImage++]); img.onload = function() { if (currentImage >= imagePaths.length) currentImage = 0; showCanvasCtx.drawImage(img,0,0,480,360); } } function prevImage() { img.setAttribute('src',imagePaths[currentImage--]); img.onload = function() { if (currentImage > imagePaths.length) currentImage = 0; showCanvasCtx.drawImage(img,0,0,480,360); } } </script> </head> <body > <br /> <div id="slideArea"> <div id="right"><input id="nxtBtn" value="Next" type="button" onclick="nextImage()"></div> <div id="left"> <input id="bkBtn"value="Back" type="button" onclick="prevImage()"></div> <div id="center"> <center> <canvas id="showCanvas" width="480" height="360" > Your browser does not support the canvas tag. <br /> Please upgrade your browser <br /><br /> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Firefox','','../../_images/Logo-FirefoxB.png',1)"><img src="../../_images/Logo-Firefox.png" name="Firefox" width="50" height="50" border="0"></a> <a href="https://www.google.com/chrome" target="_blank" onmouseover="MM_swapImage('Chrome','','../../_images/Logo-ChromeB.png',1)" onmouseout="MM_swapImgRestore()"><img src="../../_images/Logo-Chrome.png" name="Chrome" width="50" height="50" border="0" id="Chrome" /></a> <a href="http://www.apple.com/safari/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Safari','','../../_images/Logo-SafariB.png',1)"><img src="../../_images/Logo-Safari.png" name="Safari" width="50" height="50" border="0" id="Safari" /></a> <a href="http://windows.microsoft.com/en-US/internet-explorer/downloads/ie" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('IE','','../../_images/Logo-IEB.png',1)"><img src="../../_images/Logo-IE.png" name="IE" width="50" height="50" border="0" id="IE" /></a> <a href="http://www.opera.com/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Opera','','../../_images/Logo-OperaB.png',1)"><img src="../../_images/Logo-Opera.png" name="Opera" width="50" height="50" border="0" id="Opera" /></a> </canvas> </center> This doesn't quite work. If you click on the back button it goes forward one slide then back Then when you click the next button you have to click it several times before it will go forward again. Any help would be greatly appreciated Hey, I need help. I have my HTML/CSS/Javascript slideshow working fine, the images fades in and out nicely. Now I realized I'd like to implement next and prev buttons, but I don't know how to code this and what to refer to in the existing code. Please help? I have ten thumbnails total. Here's the Javascript: <script type="text/javascript"> slidePrefix = "slide-"; slideControlPrefix = "slide-control-"; slideHighlightClass = "highlight"; slidesContainerID = "slides"; slidesControlsID = "slides-controls"; slideDelay = 3000; slideAnimationInterval = 30; slideTransitionSteps = 10; function setUpSlideShow() { // collect the slides and the controls slidesCollection = document.getElementById(slidesContainerID).children; slidesControllersCollection = document.getElementById(slidesControlsID).children; totalSlides = slidesCollection.length; if (totalSlides < 10) return; //go through all slides for (var i=0; i < slidesCollection.length; i++) { // give IDs to slides and controls slidesCollection[i].id = slidePrefix+(i+1); slidesControllersCollection[i].id = slideControlPrefix+(i+1); // attach onclick handlers to controls, highlight the first control slidesControllersCollection[i].onclick = function(){clickSlide(this);}; //hide all slides except the first if (i > 0) slidesCollection[i].style.display = "none"; else slidesControllersCollection[i].className = slideHighlightClass; } // initialize vars slideTransStep= 0; transTimeout = 0; crtSlideIndex = 1; // show the next slide showSlide(2); } function showSlide(slideNo, immediate) { // don't do any action while a transition is in progress if (slideTransStep != 0 || slideNo == crtSlideIndex) return; clearTimeout(transTimeout); // get references to the current slide and to the one to be shown next nextSlideIndex = slideNo; crtSlide = document.getElementById(slidePrefix + crtSlideIndex); nextSlide = document.getElementById(slidePrefix + nextSlideIndex); slideTransStep = 0; // start the transition now upon request or after a delay (default) if (immediate == true) transSlide(); else transTimeout = setTimeout("transSlide()", slideDelay); } function clickSlide(control) { showSlide(Number(control.id.substr(control.id.lastIndexOf("-")+1)),true); } function transSlide() { // make sure the next slide is visible (albeit transparent) nextSlide.style.display = "block"; // calculate opacity var opacity = slideTransStep / slideTransitionSteps; // fade out the current slide crtSlide.style.opacity = "" + (1 - opacity); crtSlide.style.filter = "alpha(opacity=" + (100 - opacity*100) + ")"; // fade in the next slide nextSlide.style.opacity = "" + opacity; nextSlide.style.filter = "alpha(opacity=" + (opacity*100) + ")"; // if not completed, do this step again after a short delay if (++slideTransStep <= slideTransitionSteps) transTimeout = setTimeout("transSlide()", slideAnimationInterval); else { // complete crtSlide.style.display = "none"; transComplete(); } } function transComplete() { slideTransStep = 0; crtSlideIndex = nextSlideIndex; // for IE filters, removing filters reenables cleartype if (nextSlide.style.removeAttribute) nextSlide.style.removeAttribute("filter"); // show next slide showSlide((crtSlideIndex >= totalSlides) ? 1 : crtSlideIndex + 1); //unhighlight all controls for (var i=0; i < slidesControllersCollection.length; i++) slidesControllersCollection[i].className = ""; // highlight the control for the next slide document.getElementById("slide-control-" + crtSlideIndex).className = slideHighlightClass; } </script> And here's the HTML: <body onload="setUpSlideShow()"> <div id="slideshow"> <div id="slides"> <div class="slide"><img src="images/image1.jpg" width="1020" height="500"/>Slide content 1</div> <div class="slide"><img src="images/image2.jpg" width="1020" height="500"/>Slide content 2</div> <div class="slide"><img src="images/image3.jpg" width="1020" height="500"/>Slide content 3</div> <div class="slide"><img src="images/image4.jpg" width="1020" height="500"/>Slide content 4</div> <div class="slide"><img src="images/image5.jpg" width="1020" height="500"/>Slide content 5</div> <div class="slide"><img src="images/image6.jpg" width="1020" height="500"/>Slide content 6</div> <div class="slide"><img src="images/image7.jpg" width="1020" height="500"/>Slide content 7</div> <div class="slide"><img src="images/image8.jpg" width="1020" height="500"/>Slide content 8</div> <div class="slide"><img src="images/image9.jpg" width="1020" height="500"/>Slide content 9</div> <div class="slide"><img src="images/image10.jpg" width="1020" height="500"/>Slide content 10</div> </div> <div id="slides-controls"> <a href="#">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">4</a> <a href="#">5</a> <a href="#">6</a> <a href="#">7</a> <a href="#">8</a> <a href="#">9</a> <a href="#">10</a> </div> </div> On my music site, I want to keep track of the number of times each song has been played. The code below uses a clicked button to send the request. But I need to be able to send the request as each song begins to play. Or when a user clicks another song in the list. Mr Oldies online radio station I am using the audio.js script for the html5 audio player. That code is listed below as well. This code creates a division with the ID of "playing" for the active song. It is in here somewhere, where I would need to include the request to send the data to a php page which then does the work of accessing and updating a databse. I just do not know enough of Javascript to do this. Can someone show me where exactly to put the required code to do this? Thanks. Code: <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","demo_get2.asp?fname=Henry&lname=Ford",true); xmlhttp.send(); } </script> </head> <body> <h2>AJAX</h2> <button type="button" onclick="loadXMLDoc()">Request data</button> <div id="myDiv"></div> </body> </html> audio.js code the other part of the audio.js script can be found here http://mroldies.net/test/audio.js Code: <script> var loadedobjects="" var rootdomain="http://"+window.location.hostname function ajaxpage(url, containerid){ var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } page_request.open('GET', url, true) page_request.send(null) } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) document.getElementById(containerid).innerHTML=page_request.responseText } function loadobjs(){ if (!document.getElementById) return for (i=0; i<arguments.length; i++){ var file=arguments[i] var fileref="" if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding if (file.indexOf(".js")!=-1){ //If object is a js file fileref=document.createElement('script') fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", file); } else if (file.indexOf(".css")!=-1){ //If object is a css file fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("type", "text/css"); fileref.setAttribute("href", file); } } if (fileref!=""){ document.getElementsByTagName("head").item(0).appendChild(fileref) loadedobjects+=file+" " //Remember this object as being already added to page } } } </script> Hi, Is there any possibility of having the JW player playlist at the bottom. If possible can anyone post the javascript and its attribute for that. Thanks, Ananth Hi, I currently created a video uploader, but when the video is too big in size, the page seems to be not doing any until the video is completely uploaded. I want to put somewhat like "loading.. please wait" script until the video is not completely uploaded. Thanks. //Ana Hi I am trying to implement a scroll to DIV (i.e. smooth scrolling with some easing) on various events in jPlayer, a javascript audio playlist. Essentially the playlist is in a scrolling DIV with scrollbars and mousewheel scrolling, and when the track changes I would like it to trigger a scroll to the currently playing track, i.e. the new track, such that it is centred vertically in the DIV (which has a variable height). I thought I would start first with trying to add some code to the #jplayer_next event which usually looks like this: Code: $("#jplayer_next").click( function() { playListNext(); $(this).blur(); return false; }); I came up with the following code to add: Code: $("#jplayer_playlist").scrollTop($(".jplayer_playlist_current").offset().top); where #jplayer_playlist is the scrolling DIV and .jplayer_playlist_current is the class of the currently playing track. The code does do something, but I am seeing fairly nonsensical jumping around the div, which does seem somewhat related to the currently playing track, but certainly not what I am looking for. You can see the playlist here. The currently playing track is highlighted in green, and, when you click on the next button, the DIV certainly isn't scrolling smoothly to the currently playing track! If someone could help me amend the code to get this working properly I'd be grateful. Thanks, Nick I currently found a script that loads an ASX playlist dinamically, allowing the user to choose the item that he wants to watch in Windows media player embedded. The trouble is that once the user click on the link in the playlist it wont work. Take a look here http://tv.mghospedagem.com/wmp-pl3.html Works only on IE. Code: <head> <script language="javascript1.2"> playListLoaded=false; function loadPlayItems() { df=document.getElementById("playItem"); dp=document.getElementById("playlist"); WMP9=document.getElementById("MediaPlayer1"); WMP9.url="http://tv.mghospedagem.com/play.asx"; WMP9.controls.play(); } function showPlayItems() { WMP9=document.getElementById("MediaPlayer1"); playlistItems=WMP9.currentPlaylist.count; for (i=0; i<playlistItems; i++) { playitem=document.createElement("a"); playnext=document.createElement("br"); playitem.setAttribute("href","#"); playitem.setAttribute("onclick","playItem("+i+")"); playitem.innerText=WMP9.currentPlaylist.item(i).name; dp.appendChild(playitem); dp.appendChild(playnext); } playListLoaded=true; WMP9.controls.play(); } function setPlayItem(index) { WMP9=document.getElementById("MediaPlayer1"); playlistItems=WMP9.currentPlaylist.count; if (playlistItems > 0) { WMP9.controls.currentItem=WMP9.currentPlaylist.item(index); WMP9.controls.play(); } } </script></head> <body onLoad="loadPlayItems()"> <object id="MediaPlayer1" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject" width="600" height="400"> <param name="autostart" value="1"> <param name="showcontrols" value="1"> <param name="uimode" value="full"> <param name="stretchtofit" value="1"> <param name="enablecontextmenu" value="0"> </object> <div id="playlist" style="position: absolute; top: 10px; left: 640px; visibility: visible; z-index: 999999999999999;"> <h2>Playlist</h2></div> <script language="javascript1.2" for="MediaPlayer1" event="playStateChange"> WMP9=document.getElementById("MediaPlayer1"); if (WMP9.playState==3 && ! playListLoaded) { showPlayItems(); } </script> From an iframe, I want to load and play a playlist in a wimpy mp3 player in the parent page. I can do it as if it is a popup window but it requires that from one iframe, I reload the player in the other iframe. Here are the functions given by wimpy: Code: <script language="JavaScript" type="text/JavaScript"> <!-- var wimpyWindow; var winOpen= 0; function wimpyPopPlayer(wimpyPopPage,theWidth,theHeight) { wimpyWindow = window.open(wimpyPopPage,'wimpyMP3player','width='+theWidth+',height='+theHeight); winOpen=1; } function wimpyPopPlayerWithFile(wimpyPopPage,initialFile,theWidth,theHeight) { wimpyWindow = window.open(wimpyPopPage+'?theFile='+initialFile,'wimpyMP3player','width='+theWidth+',height='+theHeight); winOpen=1; } function wimpyIsOpen(){ if (winOpen==1){ if (wimpyWindow.closed){ return false; } else { return true; } } else { return false; } } function wimpyPopAndPlay(startOnLoad, theFile, theArtist, theTitle, graphicURL, hotlinkURL){ if(wimpyIsOpen()){ wimpyWindow.wimpy_addTrack(startOnLoad, theFile, theArtist, theTitle, graphicURL, hotlinkURL); } else { wimpyPopPlayerWithFile('home2.shtml',theFile,'325','350'); } } //--> </script> Is there a way to do it that targets the player in the iframe without treating it like a popup window? Any help greatly appreciated! Hello guys, I've made a music playlist where you should be able to listen to music (of course). All works fine, i am capable too listen to all the music in my playlist. But, when i reload my website and click on a song, it send me an error message - "Adobe Flash Player has stopped a potentially unsafe operation. If you want the program to communicate with Internet, click on settings." When i click on settings, i get another message - "Sorry, this page is not available". I had also another Option instead of settings which where, "ok". When i click on OK it works fine and it's no problem to scroll through the musiclist and listen to all of the soft songs. But i don't even want the message to appear from the very first time. Do you know what i should do to get rid of the message? Here's my code: Code: <!-- BEGIN JAVASCRIPT PLAYER EMBED CODE --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> <div id="player-holder"></div> <script type="text/javascript"> var options = {}; options.playlistXmlPath = "playlist.xml"; var params = {}; params.allowScriptAccess = "always"; swfobject.embedSWF("OriginalMusicPlayerPlaylist.swf", "player-holder", "250", "250", "9.0.0",false, options, params, {}); </script> <!-- END PLAYER EMBED CODE --> Regards Webjoker Hi guys, I'm trying to make a "mini image slider" and I want to create a next and prev buttons to show hidden images. Ex: I have a list with images and when I click on the next button I want to show the next hidden image. I've tried to do it with jquery but I can't. Code: <ul> <li><img src="image" alt="" 1="">Image 1</li> <li><img src="image" alt="" 2="">Image 2</li> <li><img src="image" alt="" 3="">Image 3</li> <li><img src="image" alt="" 4="">Image 4</li> <li><img src="image" alt="" 5="">Image 5</li> </ul> Can some one help me to achieve that? Hey guys. This is vague because I dont know what exactly to tell you but please reply with me so I can fix this. I want to add something to my forum. Specifically, I want to add a HTML and Picture button for when you go to reply. Like posting an article here, there are also these options (font, alignment, insert image) I do not know how to achieve this but shouldnt be too hard. Here are the two sources you will need to look through to help me fix the forum. http://neoweather.com/FWFORUM.JS http://static.websimages.com/JS/fw.js THANKS Hey guys. I want to add something to my forum. Specifically, I want to add a HTML and Picture button for when you go to reply. Like posting an article here, there are also these options (font, alignment, insert image) I do not know how to achieve this but shouldnt be too hard. Here are the two sources you will need to look through to help me fix the forum. http://neoweather.com/FWFORUM.JS http://static.websimages.com/JS/fw.js THANKS Hi, I am not entirely sure what I am doing wrong here, and I have been looking at this for ages, so apologies in advance if I have become so bleary eyed I can't see something simple. I use php to create buttons based on values pulled for a table. The problem I have is when you click on the first button the javascript function works great, when you click on the next button you get the same output even though it should be different results. I am working in ff and I can see on my firebug console that the javascript function is being called, but it is not passing the new value of the second or third button, it just keeps repassing the value of the first button. So not entirely sure where I am going wrong here. My page is: Code: <script type="text/javascript"> function loadXMLDoc2(File,ID,Msg){ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById(ID).innerHTML=xmlhttp.responseText; } } var params=Msg; xmlhttp.open("POST",File,true); xmlhttp.setRequestHeader("Pragma", "Cache-Control:no-cache"); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", params.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(params); } </script> <head> <body> <?php $con = mysql_connect("localhost","user","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mydb", $con); $result = mysql_query("SELECT DISTINCT theme FROM goods WHERE category='{$_POST['category']}' ORDER BY theme DESC"); while($row = mysql_fetch_array($result)){ echo '<input type="text" class="hidden" name="theme" id="theme" value="' . $row['theme'] . '" ><input type="button" class="button3" name="product" id="product" value="' . $row['product'] . '" onClick="loadXMLDoc2(\'getShow.php\',\'txtHint\',\'theme=\'+encodeURI(document.getElementById(\'rtheme\').value))" > '; } echo '<br /><br /> <div id="txtHint"><div> <br /> <br />'; mysql_close($con); ?> And getShow.php produces a table with a list of product images, names and prices, based on theme. So basically not sure where I am going wrong here? i'm still a relative noob and this has me stuck - i have a save button with a "save as copy" in the save dropdown list. add new item directs to a premade/formatted project that is used as a template, so on that item i only want/need the "save as copy" but on all other items that use the form i need to only have the "save" function. is there any way to either change the function of the button depending on item that is being viewed in the edit screen OR hide the "save" button and only show the button associated with "save as copy - and vis versa for the rest of the items?? current button code is - protected function getToolbar() { $options = array(); $user = JFactory::getUser(); $create_ms = $user->authorise('core.create', 'com_pfmilestones'); $create_task = $user->authorise('core.create', 'com_pftasks'); $options[] = array( 'text' => 'JSAVE', 'task' => $this->getName() . '.save'); $options[] = array( 'text' => 'Save as new project', 'task' => $this->getName() . '.save2copy', 'options' => array('access' => ($this->item->id > 0))); PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-ok')); item used as template is id=8 any help or suggestions would be greatly appreciated.. |