JavaScript - Asx Playlist Loaded Dynamically, But Links Won't Work.
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> Similar TutorialsCan somebody help me to find the problem with the below given code, its not working. $(document).on('keyup', ".add_commi", function() { typingTimer = setTimeout(doneTyping, doneTypingInterval); var pro = $(this).attr('id'); var selectvalue = $(this).html(); var id = pro.slice(-2); var amount = $('#amount'+id).html(); var rate = $('#v_rate'+id).html(); //alert('working'); var data = 'cur_amount='+cur_amount +'&cur_rate='+cur_rate+'&commision='+selectvalue; $.ajax({ type: "POST", dataType: "json", url: "http://localhost/agent/buy-currency-calculations/", data: data, success: function(output){ var cus_rate = output.cus_rate; var total = output.total; var tot_commision = output.commision; alert(cus_rate, total, tot_commision); $('#curr_rate'+id).html(cus_rate); $('#tot'+id).html(total); $('#tot_commi'+id).html(tot_commision); } }); return false; }); Reply With Quote 01-09-2015, 02:53 PM #2 Dormilich View Profile View Forum Posts Senior Coder Join Date Jan 2010 Location Behind the Wall Posts 3,532 Thanks 13 Thanked 372 Times in 368 Posts cur_amount, cur_rate and selectvalue are supposedly primitive values (like numbers) but you fetch them as HTML code which the interpreting server script certainly can’t process. (if it should be indeed primitives, you should rather consider using form elements for that). despite that jQuery has a method to fetch values off a form, which might be easier to implement, but that depends on the used HTML code. additionally, in your browser’s dev tools you can check the network pane for what values are sent/received in the AJAX call. I have a javascript function that changes the src and href of an image within a repeating function. If i call document.getelementbyid("image").src, i can change the image and by calling document.getelementbyid("image").Href, i am able to change the link. The problem i have now is that when the cursor goes over the image it gets the link location as a snapshot. If i leave my cursor and the image and link location changes, it does not update the snapshot and if i click on the new image it uses the previous link rather than the new one. The only way to get the new link is to move off the image and back on to get a new snapshot of the new link. Is there a way i can tell the javascript to change the image, link location and update the browser to the new link without moving the cursor.
im trying to create a script for greasemonkey (tried getting help from their discussion forums, but no one ever answers), but its still written in javascript. so here is what im trying to do. Ive got a dynamically created division that aligns to the right of the browser window. Now im trying to put links inside it as you normally would with like a document.write statement or other methods. The only problem is, any method i try wont work for me. heres my code, maybe someone could give me some things i could try. Code: function QuickLinks() { var body = document.body; var div2 = document.createElement("div"); div2.setAttribute('class','QL'); div2.setAttribute('style','background-color: #692510;width: 200px;height: 500px;top: 2cm;position: absolute;right: 5px;z-index: 4;'); var links = document.createTextNode("where i want my links"); //now with that statement it just writes text, ive tried document.write and many other methods and nothing seems to work. div2.appendChild(links); //this just inserts the links into the div. body.appendChild(document.createElement('br')); body.appendChild(div2); } QuickLinks(); Hi, first post here! I have inserted a 'fisheye' widget to dreamweaver. It works great. I created a link from the home button. When i test it and over the button with my mouth its shows the link but does not open the window. Would anyone have an idea or lead on how I can solve this issue? As well can i post the link of the page? Thanks for ur help and time. Hi Everyone, I have a strange problem that I can't resolve. Have a look at www.snaptease.co.uk/random.html and you will see a random image every time you refresh. Now look at www.snaptease.co.uk/random1.html and you won't see the image. The only difference is in the js/random.js and js/random1.js each file references. js/random.js uses the same html link to index.html js/random1.js links to individual html files that exist and valid. The working code looks like this: [CODE] images[0] = "<a href = 'index.html'><img src='images/games/aa01q.jpg' alt='album art' title='Do you recognise this album?'></a>";[CODE] The non working code looks like this: [CODE] images[0] = "<a href = 'answers/aa01.html'><img src='images/games/aa01q.jpg' alt='album art' title='Do you recognise this Album?'></a>";[CODE] Even if I enter the full url it makes no difference. Please tell me what I am doing wrong and how to fix it. I've been banging my head over this for a while now so I would appreciate any help. Thanks in advance Martin 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 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. 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 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 ! 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. 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 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 i have an iframe on my webpage and i am loading appropriate page in it by clicking appropriate button but when user logs out and at that time some page is opened in iframe corresponding to the login pages(like "edit profile") of user then at that moment i want to know that what page is loaded in iframe so that i close it(if it corresponds to pages of login like "edit profile") as user logs out and if it does not correspond to login pages then it remains as it is.For doing that i must know that what page is loaded in iframe and compare it in " if(condition){statement} in logout function" with the logion pages so that i know that if any of them is loaded in iframe and if loaded then close it.Can you help me with that by giving exact code example. I am using a jquery gallery slideshow on my homepage and I am having an issue where the images loaded before the dom is loaded causing the images to display in an ugly stack. I combated this a bit by setting a height on the div and setting the overflow to hidden. however you can still see the unstyled stack of images within the small div for a couple of seconds before the page is loaded. the code to start the javascript is: Code: <script type="text/javascript"> $(document).ready(function(){ $('#photos45').galleryView({ panel_width: 980, panel_height: 300, gallery_width: 980, gallery_height: 900, frame_width: 120, frame_height: 50, pause_on_hover: true, nav_theme: 'light' }); }); </script> and the html is: Code: <div style="height:360px; overflow:hidden; " > <ul id="photos45"> <li><img src="../site_files/banners/cush.jpg" alt="Baffin Cush"/></a></li> <li><img src="../site_files/banners/coveralls.jpg" alt="Big Al Coveralls"/></li> <li><img src="../site_files/banners/chloe.jpg" alt="Baffin Chloe" /></li> <li><img src="../site_files/banners/chloe.jpg" alt="Baffin Chloe" /></li> </ul> </div> I have a feeling that this has something to do with the .ready function maybe it should be something else? You can see this in action he http://bit.ly/8QRXWU Hello everyone, I have a code in JavaScript that crops an image, but I have a problem: the image have to be loaded before I cropped it.. so I have to add an examination that ONLY when the image was loaded, crop it.. (I need a code that works all browsers).. I think I need an operation that is called: Complete(). can somenone help me please? my english is not very good so I hope I explained my problem well.. Thank you all!! |