JavaScript - Help Embedding Voting Button
Similar TutorialsVoting button on the poll in the left column works fine if you take the sharethis javascripts out. Why won't they work together though? <script type="text/javascript" src="http://www.claimsheaven.co.uk/polls/admin/script.js"></script> <script type="text/javascript">var switchTo5x=true;</script> <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script> <script type="text/javascript" src="http://s.sharethis.com/loader.js"></script> e.g. on this page: http://www.claimsheaven.co.uk/news/20120305.php I run a site on tumblr. I know its not as good as wordpress and doesn't allow as many options but I am looking to create a unique voting option for each post. Like an up down vote. Any ideas on how to set this up? Can it be done? Thanks, Thomas All, Does anyone know a good example on where to find something that when I click on vote it calculates the results and then shows me horizontal bars to show the percentage for each vote? There will only be two? Thanks in advance. Hello, I am new to this forum and hope this is in the right place but I have been trying to code (with no success) a voting system with PHP/MySql and jQuery for a clients webpage and am about to throw my computer out the window. Any help/advice would be appreciated, heres my dilemma. I need to create a simple system where a viewer can vote (only one vote) between two options (only 2). Example: [heading]Do you brush your teeth [radio button]Option 1: Yes [radio button]Option 2: no [submit] upon submission jQuery would then show the results without leaving the page. there is also 16 things to vote on per page (i dont know if this changes anything) Thanks in advance, J I'm having trouble duplicating my working voting function code. It only works with one copy, but once I copy and paste it into a second copy it seizes it to work no matter what I do even if I change the name, value, class or id names. If I press the vote up or vote down button it affects only one of the copies Here is an incomplete fiddle that need some troubleshooting: Edit fiddle - JSFiddle Help me figure out how to get an independent second copy of the following code: Javascript: Code: $(document).ready(function() { $('.vote').click(function() { $('img', this).attr('src', function(i, oldSrc) { return oldSrc == 'voteup.png' ? 'votedown.png' : 'voteup.png'; }); $('.voteswitch').toggle(400); return false; }); }); function showMessage(which) { if (which == 1) { document.getElementById("voteup").style.display = "block"; document.getElementById("votedown").style.display = "none"; document.getElementById("notrated").style.display = "none"; } else { document.getElementById("voteup").style.display = "none"; document.getElementById("votedown").style.display = "block"; document.getElementById("notrated").style.display = "none"; } } HTML: Code: <!-- Voting--> <div class="votesystem"> <input name="vote" class="voteup" type="radio" value="Yes" onclick = "showMessage(1)"/> <label class="voteup-label" for="voteup"></label> <!--Vote Number--> <div class="votenumber"> <div id="voteup" style="display:none">100<span class="percentagesign">%</span></div> <div id="notrated">Not Rated</div> <div id="votedown" style="display:none">0<span class="percentagesign">%</span></div> </div><!--End Votenumber--> <input name="vote" class="votedown" type="radio" value="No" onclick = "showMessage(2)"/> <label for="votedown"></label> <p class="votecounter">0 Votes</p> </div><!--End Voting--> CSS: Code: .votesystem { display:inline-block; list-style-type: none; padding-top:3px; border-left:#000 1px solid; border-bottom:#000 1px solid;width:85px; text-align:center; height:107px; float:right; position:relative; } input.voteup a { background-image: url('http://janosgyerik.github.io/jquery-upvote/lib/images/sprites-programmers.png?v=1'); background-repeat: no-repeat; overflow: hidden; display: block; margin: 0 auto; width: 41px; height: 25px; } input.voteup[type="radio"]{ opacity: 0; right:33px; margin-top:7px; position:absolute; cursor:pointer; } input.voteup[type="radio"]+label{ background:: url('http://janosgyerik.github.io/jquery-upvote/lib/images/sprites-programmers.png?v=1'); background-position: 0px -230px; padding-left:40px; padding-bottom:10px; } input.voteup[type="radio"]:checked+label{ background: url('http://janosgyerik.github.io/jquery-upvote/lib/images/sprites-programmers.png?v=1'); background-position: 0px -230px; } input.voteup[type="radio"]:hover+label{ background: url('http://janosgyerik.github.io/jquery-upvote/lib/images/sprites-programmers.png?v=1'); padding-left:40px; padding-bottom:10px; background-position: 0px -230px; } input.votedown[type="radio"]{ opacity: 0; right:33px; margin-top:-5px; position:absolute; cursor:pointer; } input.votedown[type="radio"]+label{ background: url('http://janosgyerik.github.io/jquery-upvote/lib/images/sprites-programmers.png?v=1'); background-position: 0px -300px; padding-left:40px; padding-top:9px; } input.votedown[type="radio"]:checked+label{ background: url('http://janosgyerik.github.io/jquery-upvote/lib/images/sprites-programmers.png?v=1'); background-position: 0px -330px; padding-left:40px; padding-top:9px; } input.votedown[type="radio"]:hover+label{ background: url('http://janosgyerik.github.io/jquery-upvote/lib/images/sprites-programmers.png?v=1'); padding-left:40px; padding-top:9px; background-position: 0px -330px; } .votenumber { color:#666; font-size:22px; margin:0; font-weight:bold; font-family:Arial, Helvetica, sans-serif; line-height:42px; padding-top:5px; padding-bottom:2px; } #notrated { font-size:15px; color:#999; } #voteup { margin-left:-2px;} #votedown { margin-left:-2px;} .percentagesign { font-size:15px; margin-top:-3px; position:absolute; } .contentarea { width:100%; height:100%; background-color:#CF3; display:block; } .votecounter { position:relative; top:8px; color:#000; font-family:Tahoma, Geneva, sans-serif; font-size:12px; } Hi there, does anoyne know how to embed a RSS feed into a webpage? The code I was using before is now no longer supported Thanks Joe Hi - I am using the tinyslideshow and need to be able to embed a wmv file into it. It needs to open within the slideshow as the thumbnail loads and when clicked just as the image does. I have not been able to figure this out or know if it is possible and any help would be greatly appreciated! Thanks so much.
i'm newb to java, but need to get my quicktime movie embeds working on windows/explorer. apparently i need to call external java script to make it work: http://developer.apple.com/internet/ieembedprep.html here is my HEAD code: <script src="kitchslideembed.js" language="JavaScript" type="text/javascript"></script> and BODY code: <script language="JavaScript"type="text/javascript">InsertKitchSlideMovie();</script> and my "kitchslideembed.js" file... function InsertKitchSlideMovie() { document.write('<object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width="768" height="591" codebase='http://www.apple.com/qtactivex/qtplugin.cab'>\n'); document.write('<param name='src' value="http://jamesgivensdesign.com/public_html/notes/kitchenslide1.mov">\n'); document.write('<param name='autoplay' value="false">\n'); document.write('<param name='controller' value="true">\n'); document.write('<param name='loop' value="false">\n'); document.write('<embed src="kitchenslide1.mov" width="768" height="591" autoplay="false" controller="true" loop="false" pluginspage='http://www.apple.com/quicktime/download/'>\n'); document.write('</embed>\n'); document.write('</object>\n'); } any help out there? I'm trying to embed flash onto a web page using the flash player that comes with Dreamweaver CS4. I've used other players in the past, such as the Longtail FLV player, but need to use one that's free for commercial use in this case. I've set up the file with a script to load the video dynamically using the swfobject (the CS4 flash player uses a modified version, not sure what's different about it). Everything works as expect on PC, but on Mac for some reason instead of playing the video it just displays the components of the flash player's skin (i.e. play button, etc.). Here's the script: Code: <script src="scripts/swfobject_modified.js" type="text/javascript"></script> <script type="text/javascript"> var flashvars = {}; flashvars.MM_ComponentVersion = '1'; flashvars.skinName = "skins/Halo_Skin_3"; flashvars.streamName = "videos/base"; flashvars.autoPlay = "false"; var params = {}; var attributes = {}; swfobject.embedSWF("FLVPlayer_Progressive.swf", "myContent", "768", "432", "9.0.0","expressInstall.swf", flashvars, params, attributes); </script> And the HTML: Code: <div id="myContent"> <p>Some content requires Adobe Flash Player. You can download it <a href="http://get.adobe.com/flashplayer/" rel="nofollow" target="_blank">here</a></p> </div> Any thoughts on what might be causing the problem? Thanks. I'm getting Error: Object doesn't support property or method 'addEvent' in my webpage. I'm trying to embed a flash carousel in an asp.net page and I have this, but nothing is showing on my page. Using IE9 and FF4 Code: <script type="text/javascript"> window.addEvent('load', function() { var flashvars = { xmlLocation: "<%=ResolveUrl("upload/data.xml")%>", imageLocation: "<%=ResolveUrl("~/upload/")%>" }; swfobject.embedSWF("<%=ResolveUrl("~/upload/Carousel-Test.swf")%>", "FlashContainer", "576", "242", "10.0.32", "", flashvars, null, null); }); </script> The xml has some settings for the images and all my images are in the upload folder in my project. I have reference to the swfobject js in the masterpage (head) and the homepage inherits from it: Code: <script src="javascript/swfobject.js" type="text/javascript"></script>. Anyone give some suggestions? see below
For a project in my high school web design class, I need to integrate an Excel spreadsheet as data so to speak for a web page. I want to pull the prices from the sheet, and make them appear on the page. I'd like to pull it from the sheet so that the client can still adjust and edit the prices without having to reach the actual webpage. Conceptually, I thought this would be fairly straight forward, but in researching how to do this, I got very confused. I'm not even positive that I'm putting this in the right section. So my main question is this: Is there a way to integrate an Excel spreadsheet in such a way that it can provide data for certain fields of a webpage? If so, can someone please explain how? Thanks, A Confused High School Girl Hello, This question is not really about js per se, but more having to do with w3c specifications. I did not see a more appropriate place to post it. I wish there were such a thing as a w3c forum. I have a large number of QT movies in an archive that I have been displaying using the ol' object/embed tag method. In an attempt to bring the pages up to w3 standards, which does not allow embed tags, I have considered this recommendation from Apple for embedding QT videos: http://developer.apple.com/internet/ieembedprep.html Great, now the pages validate. However, when viewing the generated source written by the js, what do I find? Exactly the same code I used that would not validate - object tags with an embed tag in the container. My question may be somewhat philosophical : Is this just merely a way of "tricking" the w3 validator? I mean, if the effective code that the browser sees is the same, why not just put it in there with HTML in the first place, other than to be able to put the w3 'validates!' icon at the bottom of the page? You see what I am getting at? 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 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.. 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 got javascripts button : Code: <input type="button" value="select" onClick="document.getElementById('input').select()" /> how can i transform "button" to image button (gif) I have 4 rows in a table. Each row consist of 4 radio buttons. Each radio button per row has different values in it but has the same name (group) ex: <input type="radio" name="a" value="1"> <input type="radio" name="a" value="2"> <input type="radio" name="a" value="3"> <input type="radio" name="a" value="4"> <input type="radio" name="b" value="1"> <input type="radio" name="b" value="2"> <input type="radio" name="b" value="3"> <input type="radio" name="b" value="4"> and so on.. If I click radio button A with value 2, I want to output the total at the bottom as "2".. Also, if I click radio button B with value 3, I want to output the total of A and B as 5 and so on.. How can I automatically calculate the answer based on which radio button was click? update: I got my answer from this site: http://stackoverflow.com/questions/1...s-using-jquery i am trying to make a button which is a .gif that will change when a mouse over occurs and a animation will occur when click then will relocate to a new page but i am getting multiple images at the same time pleas help. Code: <html> <body> <img src="Jepordy/Fla files/Button set 1.gif" > <img name="jsbutton" src="Jepordy/Fla files/Button set 1.gif" width="550" height="400" border="0" alt="javascript button"> <SCRIPT language="JavaScript"> var myimgobj = document.images["jsbutton"]; </SCRIPT> <A href="#" onMouseOver="return changeImage()" ><img name="jsbutton" src="Jepordy/Fla files/Button mouse over.gif" width="550" height="400" border="0" alt="javascript button"></A> <SCRIPT language="JavaScript"> function changeImage() { document.images["jsbutton"].src= "C:\Documents and Settings\fus10n\Desktop\Jepordy\Fla files\Button mouse over.gif"; return true; } </SCRIPT> <A href="#" onMouseOver="return changeImage()" onMouseOutwidth="550" height="400" border="0" alt="javascript button"= "return changeImageBack()" onMouseDown="return handleMDown()" onMouseUp="return handleMUp()" ><img name="jsbutton" src="Jepordy/Fla files/Button set 1.gif" width="550" height="400" border="0" alt="javascript button"></A> <SCRIPT language="JavaScript"> function changeImage() { document.images["jsbutton"].src= "C:\Documents and Settings\fus10n\Desktop\Jepordy\Fla files\Button set 1.gif"; return true; } function changeImageBack() { document.images["jsbutton"].src = "C:\Documents and Settings\fus10n\Desktop\Jepordy\Fla files\Button set 1.gif"; return true; } function handleMDown() { document.images["jsbutton"].src = "C:\Documents and Settings\fus10n\Desktop\Jepordy\Fla files\Button set 1.gif"; return true; } function handleMUp() { changeImage(); return true; } </SCRIPT> <A href="QUESTION LOCATION FOR THIS BUTTON GOES HERE!" onMouseOver="return changeImage()" onMouseOut= "return changeImageBack()" onMouseDown="return handleMDown()" onMouseUp="return handleMUp()"> <A href="http://www.javascript-coder.com/" onMouseOver="return changeImage()" onMouseOut= "return changeImageBack()" onMouseDown="return handleMDown()" onMouseUp="return handleMUp()" ><img name="jsbutton" src="Jepordy/Fla files/Button mouse over.gif" width="550" height="400" border="0" alt="javascript button"></A> </body> </html> |