JavaScript - Fixing Forum Through Javascript Source: Adding Picture Button And Html Button
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 Similar TutorialsHey 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 Good morning! Hopefully somebody can help me with this javascript question. (No knowledge of Google Anayltics needed for this.) I'm adding Google Analytics 'Event Tracking' javascript to a typical 'Add to Cart' button. The customer enters desired quantity in the text box and clicks the 'Add to Cart' button to order. I would like to use the Event Tracking javascript to record the button click - plus the Value entered in the text box - as one event. Here's the code for the form (the text box and 'Add to Cart' button code lines are bold): Code: <form method="post" action="http://www.yoursite.com/mm5/merchant.mvc?"> <input type="hidden" name="Screen" value="BASK" /> <input type="hidden" name="Product_Code" value="yourproductcode" /> <input type="hidden" name="Action" value="ADPR" /> <label for="quantity">Quantity:</label> <input type="text" name="quantity" value="0" /> <input type="submit" value="Add To Cart" /> </form> I came up with this javascript for the Event Tracking (to be inserted somewhere above): Code: onClick="_gaq.push(['_trackEvent', 'OrderForms', 'AddToCart', 'yourproductcode', document.getElementByName('quantity').value]);" I'm wondering where I would enter this javacript code inside the form code to pick up both the button click - plus the quantity? You'll notice that I'm using 'getElementByName' to extract 'quantity' from the text box and record its 'value'. If I enter this javascript on the 'Add to Cart' line - right after "Add to Cart", would 'quantity' still get picked up upon button-click - since it's all on the same form? Or would it be a problem because 'quantity' is contained in a different <input> container? Thanks! Any help is greatly appreciated. IB 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 have a script which creates an element of iframe. I have a button which refreshes the iframe link. I need to do something to change a variable in the iframe src on every click of the button. I'll explain the real issue. I have a list of games I have with random name like, boomer.swf, kingdom.swf, balloon.swf and so on. So I somehow made this, Code: var r_text = new Array (); r_text[0] = "boomer"; r_text[1] = "kingdom"; r_text[2] = "balloon"; var i = Math.floor(3*Math.random()) var gamedrome = { game: ""+r_text[i]+""}; Now I have a .js file which creates iframe element Code: function embed_game(params, options) { var data = []; for(var i in params) { data.push(i + "=" + encodeURIComponent(params[i])); } data = data.join("&"); var frame = document.createElement("iframe"); frame.src = "http://website.com/embed/game.html?"+ data; frame.style.width="100%"; frame.style.height="100%"; frame.style.border = "0"; frame.frameBorder = "0"; frame.id="newroom"; .... and another small script to refresh the inner iframe and not the page to change game. Code: <script type="text/javascript"> function Reload () { var f = document.getElementById('newroom'); f.src = f.src; } </script> It all works fine until the game is loaded, but the problem is that if once the game is loaded in site, the iframe source is already set and my button keeps loading the same game. I need to randomize it on every click. Please help me out. Hi Guys, I am new at JavaScript and start to do some tutorials.What I am trying to do here is prompting user to input a name and if the name was valid the page(document) will display with all objects like the button.But if user enter a wrong name then the button will be disabled! I create the following code but it did not work <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript" type=""> function changeColor(){ document.bgColor = "Gray"; } </script> </head> <body> <script language="JavaScript" type="text/javascript"> var person = ""; person = prompt('What is Your Name:'); if (person == "Foo") { document.write("<h1 />Welcome " + person); document.bgColor = "Yellow"; } else { document.write("<h1 />Access Denied!!!!"); document.bgColor = "Red"; document.getElementById("gree").disabled = true; } </script> <div> <p/><input id="gree" type="button" value="Gray " onClick="changeColor();"> </div> </body> </html> as you can see I used the: document.getElementById("gree").disabled = true; but it did not work , could you please give an idea how I can solve this problem? Thanks Hey, In the quiz function the form that is generated all compiles correctly, but the submit button only causes the page to refresh. What am I doing wrong? Thank you var c = "1"; //counter var n = [68]; //array that stores unique random numbers var t = "better clear"; var lc = [3]; var uc = [3]; ////////////////////////////////////////////// //The generate() function generates 68 random //unique numbers. ////////////////////////////////////////////// function generate() { var gen = 0; //variable that stores random integer. var j = 1, i = 1; //integers used for loops while (j <= 68) { gen = Math.floor(Math.random()*68+1); for (i = 1; i <= j; i++) { if (n[i] == gen) { break; } else { if (i == j) { n [j] = gen; j++; break; } } } } } ////////////////////////////////////////////// //The rinfo() function reads information that //is pertinent to current question (quality //of triad (t), upper case, and //lower case answers to the question). ////////////////////////////////////////////// function rinfo() { if (n[c] == 1) { t = "a C Major"; lc[3] = "c"; //root uc[3] = "C"; //root lc[2] = "e"; //third uc[2] = "E"; //third lc[1] = "g"; //fifth uc[1] = "G"; //fifth } if (n[c] == 2) { t = "a C Minor"; lc[3] = "c"; //root uc[3] = "C"; //root lc[2] = "eb"; //third uc[2] = "Eb"; //third lc[1] = "g"; //fifth uc[1] = "G"; //fifth } if (n[c] == 3) { t = "a C Augmented"; lc[3] = "c"; //root uc[3] = "C"; //root lc[2] = "e"; //third uc[2] = "E"; //third lc[1] = "g#"; //fifth uc[1] = "G#"; //fifth } if (n[c] == 4) { t = "a C Diminished"; lc[3] = "c"; //root uc[3] = "C"; //root lc[2] = "eb"; //third uc[2] = "Eb"; //third lc[1] = "gb"; //fifth uc[1] = "Gb"; //fifth } if (n[c] == 5) { t = "a F Major"; lc[3] = "f"; //root uc[3] = "F"; //root lc[2] = "a"; //third uc[2] = "A"; //third lc[1] = "c"; //fifth uc[1] = "C"; //fifth } if (n[c] == 6) { t = "a F Minor"; lc[3] = "f"; //root uc[3] = "F"; //root lc[2] = "ab"; //third uc[2] = "Ab"; //third lc[1] = "c"; //fifth uc[1] = "C"; //fifth } if (n[c] == 7) { t = "a F Augmented"; lc[3] = "f"; //root uc[3] = "F"; //root lc[2] = "a"; //third uc[2] = "A"; //third lc[1] = "c#"; //fifth uc[1] = "C#"; //fifth } if (n[c] == 8) { t = "a F Diminished"; lc[3] = "f"; //root uc[3] = "F"; //root lc[2] = "ab"; //third uc[2] = "Ab"; //third lc[1] = "cb"; //fifth uc[1] = "Cb"; //fifth } if (n[c] == 9) { t = "a Bb Major"; lc[3] = "bb"; //root uc[3] = "Bb"; //root lc[2] = "d"; //third uc[2] = "D"; //third lc[1] = "f"; //fifth uc[1] = "F"; //fifth } if (n[c] == 10) { t = "a Bb Minor"; lc[3] = "bb"; //root uc[3] = "Bb"; //root lc[2] = "db"; //third uc[2] = "Db"; //third lc[1] = "f"; //fifth uc[1] = "F"; //fifth } if (n[c] == 11) { t = "a Bb Augmented"; lc[3] = "bb"; //root uc[3] = "Bb"; //root lc[2] = "d"; //third uc[2] = "D"; //third lc[1] = "f#"; //fifth uc[1] = "F#"; //fifth } if (n[c] == 12) { t = "a Bb Diminished"; lc[3] = "bb"; //root uc[3] = "Bb"; //root lc[2] = "db"; //third uc[2] = "Db"; //third lc[1] = "fb"; //fifth uc[1] = "Fb"; //fifth } if (n[c] == 13) { t = "an Eb Major"; lc[3] = "eb"; //root uc[3] = "Eb"; //root lc[2] = "g"; //third uc[2] = "G"; //third lc[1] = "bb"; //fifth uc[1] = "Bb"; //fifth } if (n[c] == 14) { t = "an Eb Minor"; lc[3] = "eb"; //root uc[3] = "Eb"; //root lc[2] = "gb"; //third uc[2] = "Gb"; //third lc[1] = "bb"; //fifth uc[1] = "Bb"; //fifth } if (n[c] == 15) { t = "an Eb Augmented"; lc[3] = "eb"; //root uc[3] = "Eb"; //root lc[2] = "g"; //third uc[2] = "G"; //third lc[1] = "b#"; //fifth uc[1] = "B#"; //fifth } if (n[c] == 16) { t = "an Eb Diminished"; lc[3] = "eb"; //root uc[3] = "Eb"; //root lc[2] = "gb"; //third uc[2] = "Gb"; //third lc[1] = "bbb"; //fifth uc[1] = "Bbb"; //fifth } if (n[c] == 17) { t = "an Ab Major"; lc[3] = "ab"; //root uc[3] = "Ab"; //root lc[2] = "c"; //third uc[2] = "C"; //third lc[1] = "e"; //fifth uc[1] = "E"; //fifth } if (n[c] == 18) { t = "an Ab Minor"; lc[3] = "ab"; //root uc[3] = "Ab"; //root lc[2] = "cb"; //third uc[2] = "Cb"; //third lc[1] = "eb"; //fifth uc[1] = "Eb"; //fifth } if (n[c] == 19) { t = "an Ab Augmented"; lc[3] = "ab"; //root uc[3] = "Ab"; //root lc[2] = "c"; //third uc[2] = "C"; //third lc[1] = "e"; //fifth uc[1] = "E"; //fifth } if (n[c] == 20) { t = "an Ab Diminished"; lc[3] = "ab"; //root uc[3] = "Ab"; //root lc[2] = "cb"; //third uc[2] = "Cb"; //third lc[1] = "eb"; //fifth uc[1] = "Eb"; //fifth } if (n[c] == 21) { t = "a Db Major"; lc[3] = "db"; //root uc[3] = "Db"; //root lc[2] = "f"; //third uc[2] = "F"; //third lc[1] = "a"; //fifth uc[1] = "A"; //fifth } if (n[c] == 22) { t = "a Db Minor"; lc[3] = "db"; //root uc[3] = "Db"; //root lc[2] = "fb"; //third uc[2] = "Fb"; //third lc[1] = "ab"; //fifth uc[1] = "Ab"; //fifth } if (n[c] == 23) { t = "a Db Augmented"; lc[3] = "db"; //root uc[3] = "Db"; //root lc[2] = "f"; //third uc[2] = "F"; //third lc[1] = "a#"; //fifth uc[1] = "A#"; //fifth } if (n[c] == 24) { t = "a Db Diminished"; lc[3] = "db"; //root uc[3] = "Db"; //root lc[2] = "fb"; //third uc[2] = "Fb"; //third lc[1] = "abb"; //fifth uc[1] = "Abb"; //fifth } if (n[c] == 25) { t = "a Gb Major"; lc[3] = "gb"; //root uc[3] = "Gb"; //root lc[2] = "bb"; //third uc[2] = "Bb"; //third lc[1] = "db"; //fifth uc[1] = "Db"; //fifth } if (n[c] == 26) { t = "a Gb Minor"; lc[3] = "gb"; //root uc[3] = "Gb"; //root lc[2] = "bbb"; //third uc[2] = "Bbb"; //third lc[1] = "db"; //fifth uc[1] = "Db"; //fifth } if (n[c] == 27) { t = "a Gb Augmented"; lc[3] = "gb"; //root uc[3] = "Gb"; //root lc[2] = "bb"; //third uc[2] = "Bb"; //third lc[1] = "d"; //fifth uc[1] = "D"; //fifth } if (n[c] == 28) { t = "a Gb Diminished"; lc[3] = "gb"; //root uc[3] = "Gb"; //root lc[2] = "bbb"; //third uc[2] = "Bbb"; //third lc[1] = "dbb"; //fifth uc[1] = "Dbb"; //fifth } if (n[c] == 29) { t = "a B Major"; lc[3] = "b"; //root uc[3] = "B"; //root lc[2] = "d#"; //third uc[2] = "D#"; //third lc[1] = "f#"; //fifth uc[1] = "F#"; //fifth } if (n[c] == 30) { t = "a B Minor"; lc[3] = "b"; //root uc[3] = "B"; //root lc[2] = "d"; //third uc[2] = "D"; //third lc[1] = "f#"; //fifth uc[1] = "F#"; //fifth } if (n[c] == 31) { t = "a B Augmented"; lc[3] = "b"; //root uc[3] = "B"; //root lc[2] = "d#"; //third uc[2] = "D#"; //third lc[1] = "fx"; //fifth uc[1] = "Fx"; //fifth } if (n[c] == 32) { t = "a B Diminished"; lc[3] = "b"; //root uc[3] = "B"; //root lc[2] = "d"; //third uc[2] = "D"; //third lc[1] = "f"; //fifth uc[1] = "F"; //fifth } if (n[c] == 33) { t = "an E Major"; lc[3] = "e"; //root uc[3] = "E"; //root lc[2] = "g#"; //third uc[2] = "G#"; //third lc[1] = "b"; //fifth uc[1] = "B"; //fifth } if (n[c] == 34) { t = "an E Minor"; lc[3] = "e"; //root uc[3] = "E"; //root lc[2] = "g"; //third uc[2] = "G"; //third lc[1] = "b"; //fifth uc[1] = "B"; //fifth } if (n[c] == 35) { t = "an E Augmented"; lc[3] = "e"; //root uc[3] = "E"; //root lc[2] = "g#"; //third uc[2] = "G#"; //third lc[1] = "b#"; //fifth uc[1] = "B#"; //fifth } if (n[c] == 36) { t = "an E Diminished"; lc[3] = "e"; //root uc[3] = "E"; //root lc[2] = "g"; //third uc[2] = "G"; //third lc[1] = "bb"; //fifth uc[1] = "Bb"; //fifth } if (n[c] == 37) { t = "an A Major"; lc[3] = "a"; //root uc[3] = "A"; //root lc[2] = "c#"; //third uc[2] = "C#"; //third lc[1] = "e"; //fifth uc[1] = "E"; //fifth } if (n[c] == 38) { t = "an A Minor"; lc[3] = "a"; //root uc[3] = "A"; //root lc[2] = "c"; //third uc[2] = "C"; //third lc[1] = "e"; //fifth uc[1] = "E"; //fifth } if (n[c] == 39) { t = "an A Augmented"; lc[3] = "a"; //root uc[3] = "A"; //root lc[2] = "c#"; //third uc[2] = "C#"; //third lc[1] = "e#"; //fifth uc[1] = "E#"; //fifth } if (n[c] == 40) { t = "an A Diminished"; lc[3] = "a"; //root uc[3] = "A"; //root lc[2] = "c"; //third uc[2] = "C"; //third lc[1] = "eb"; //fifth uc[1] = "Eb"; //fifth } if (n[c] == 41) { t = "a D Major"; lc[3] = "d"; //root uc[3] = "D"; //root lc[2] = "f#"; //third uc[2] = "F#"; //third lc[1] = "a"; //fifth uc[1] = "A"; //fifth } if (n[c] == 42) { t = "a D Minor"; lc[3] = "d"; //root uc[3] = "D"; //root lc[2] = "f"; //third uc[2] = "F"; //third lc[1] = "a"; //fifth uc[1] = "A"; //fifth } if (n[c] == 43) { t = "a D Augmented"; lc[3] = "d"; //root uc[3] = "D"; //root lc[2] = "f#"; //third uc[2] = "F#"; //third lc[1] = "a#"; //fifth uc[1] = "A#"; //fifth } if (n[c] == 44) { t = "a D Diminished"; lc[3] = "d"; //root uc[3] = "D"; //root lc[2] = "f"; //third uc[2] = "F"; //third lc[1] = "ab"; //fifth uc[1] = "Ab"; //fifth } if (n[c] == 45) { t = "a G Major"; lc[3] = "g"; //root uc[3] = "G"; //root lc[2] = "b"; //third uc[2] = "B"; //third lc[1] = "d"; //fifth uc[1] = "D"; //fifth } if (n[c] == 46) { t = "a G Minor"; lc[3] = "g"; //root uc[3] = "G"; //root lc[2] = "bb"; //third uc[2] = "Bb"; //third lc[1] = "d"; //fifth uc[1] = "D"; //fifth } if (n[c] == 47) { t = "a G Augmented"; lc[3] = "g"; //root uc[3] = "G"; //root lc[2] = "b"; //third uc[2] = "B"; //third lc[1] = "d#"; //fifth uc[1] = "D#"; //fifth } if (n[c] == 48) { t = "a G Diminished"; lc[3] = "g"; //root uc[3] = "G"; //root lc[2] = "bb"; //third uc[2] = "Bb"; //third lc[1] = "db"; //fifth uc[1] = "Db"; //fifth } if (n[c] == 49) { t = "an A# Major"; lc[3] = "a#"; //root uc[3] = "A#"; //root lc[2] = "cx"; //third uc[2] = "Cx"; //third lc[1] = "e#"; //fifth uc[1] = "E#"; //fifth } if (n[c] == 50) { t = "an A# Minor"; lc[3] = "a#"; //root uc[3] = "A#"; //root lc[2] = "c#"; //third uc[2] = "C#"; //third lc[1] = "e#"; //fifth uc[1] = "E#"; //fifth } if (n[c] == 51) { t = "an A# Augmented"; lc[3] = "a#"; //root uc[3] = "A#"; //root lc[2] = "cx"; //third uc[2] = "Cx"; //third lc[1] = "ex"; //fifth uc[1] = "Ex"; //fifth } if (n[c] == 52) { t = "an A# Diminished"; lc[3] = "a#"; //root uc[3] = "A#"; //root lc[2] = "c#"; //third uc[2] = "C#"; //third lc[1] = "e"; //fifth uc[1] = "E"; //fifth } if (n[c] == 53) { t = "a D# Major"; lc[3] = "d#"; //root uc[3] = "D#"; //root lc[2] = "fx"; //third uc[2] = "Fx"; //third lc[1] = "a#"; //fifth uc[1] = "A#"; //fifth } if (n[c] == 54) { t = "a D# Minor"; lc[3] = "d#"; //root uc[3] = "D#"; //root lc[2] = "f#"; //third uc[2] = "F#"; //third lc[1] = "a#"; //fifth uc[1] = "A#"; //fifth } if (n[c] == 55) { t = "a D# Augmented"; lc[3] = "d#"; //root uc[3] = "D#"; //root lc[2] = "fx"; //third uc[2] = "Fx"; //third lc[1] = "ax"; //fifth uc[1] = "Ax"; //fifth } } function first() { alert("W"); } function quiz() { generate(); while (c <= 1) { rinfo(); var output_text = c + ". " + "Enter " + t + " triad."; document.write("<h3>"); document.writeln(output_text); document.write("</h3>"); document.write(" <form align = \"center\">"); document.write(" <input type = \"text\" size = \"2\" name = \"root\" value = \"\" maxlength = \"2\">"); document.write(" <input type = \"text\" size = \"2\" name = \"third\" value = \"\" maxlength = \"2\">"); document.write(" <input type = \"text\" size = \"2\" name = \"fifth\" value = \"\" maxlength = \"2\">"); document.write(" <input type = \"hidden\" name = \"question\" value = 1>"); document.write(" <input type = \"submit\" value=\"Check your answer\" onclick=\"first();\">"); document.write(" <\/form>"); c++; } } Hi, I was trying to add some simple javascript (toggle visibility function of a div) to the FB 'like' button and 'Google +1' button. This to simply create some more visitor interactivity by showing a thank you message for doing so. I've tried by just adding 'onclick=' to the element that actually shows the button, with a <a href="#" onlcick="..."> --element--</a> manner, and with a <span> and a <div> element around it. Neither of them work. The toggle script is 100% correct (using it actively with <a href="javascript:void(0);" onclick="javascript:toggleVisibility('feedbackform')">feedback</a> ) Of course I made sure the div id had correct name and it is unique for the toggle function. Anybody got any ideas on how to go with this? JS: Code: function toggleVisibility(controlId) { if (document.getElementById) { // DOM3 = IE5, NS6 var control = document.getElementById(controlId); if(control.style.display == "") control.style.display = "none"; else control.style.display = ""; } else { if (document.layers) { // Netscape 4 if(document.controlId.display == "") document.controlId.display = "none"; else document.controlId.display = ""; } else { // IE 4 if(document.all.controlId.style.display == "") document.all.controlId.style.display = "none"; else document.all.controlId.style.display = ""; } } } Hello I am new to javascript (4 months), I would like to add an hour to the current time each time a button is clicked. I have this code: ------------------------------------------------------------------ var hourstbutton=document.getElementById("button3"); hoursbutton.onclick=function() { var divlink=document.getElementById("math3"); var newtime2=new Date(); var currenthours2=newtime2.getHours()+1; var currentmins2=newtime2.getMinutes(); var currentsecns2=newtime2.getSeconds(); var ampm2= (currenthours2>=12) ? "P.M." : "A.M."; if (currenthours2>=13) { currenthours2-=12; } if(currenthours2<1){ currenthours2=12; } if(currentmins2<10){ currentmins2= "0" + currentmins2; } if(currentsecns2<10){ currentsecns2="0" + currentsecns2; } divlink.innerHTML=currenthours2+":"+currentmins2+":"+currentsecns2+ " "+ampm2; ------------------------------------------------------------------------ How do I tie the number of button clicks into the number of times this code is executed? Any help is appreciated thanks. I have some asp:radiobutton lists that need to update a label with the sum of their values each time a user selects a new value. I am brand new to javascripting and would like some insight on how to get this done. I have inserted my code below. Code: <asp:Label runat="server" Text="Greeting:" /> <asp:Label runat="server" ForeColor="Red" ID="lbl_GreetingScore" Text="0" /> <asp:RadioButtonList ID="rdb1_1" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Selected="True" Text="N/A" Value="4" /> <asp:ListItem Text="Yes" Value="4" /> <asp:ListItem Text="No" Value="0" /> </asp:RadioButtonList> Hey javascript newbie, Im trying to figure out how to add different radio if its selected or not example: Radio_Button1 value="5": Selected Radio_Button2 value="15": Not Selected Radio_Button3 value="25": Selected Radio_Button4 value="35": Selected var addingitup = ??? and im lost???? Good day all, I was hoping someone could help me out with the following. I currently have a slideshow that as thumbnails under a main image. The thumbnails slide left and right with hover on a button and with a click changes main image without any problems. Few things I am looking to change/add: 1. The ability to mouse over the main image and have the caption appear than disappear when the mouse is moved off. Currently I have the caption as a static text under the main image. 2. Start the thumbnail position in the middle instead of the left 3. Add mouseover buttons to the main image to give the ability to cycle through the images instead of having to always use the thumbnails. Below I've include the Javascript code: Is this the best way or is there a better way? Example of slideshow: http://neileverosborne.com/portfolios/manatees.html JAVASCRIPT: Code: var displayWaitMessage=true; // Display a please wait message while images are loading? var activeImage = false; var imageGalleryLeftPos = false; var imageGalleryWidth = false; var imageGalleryObj = false; var maxGalleryXPos = false; var slideSpeed = 0; var imageGalleryCaptions = new Array(); function startSlide(e) { if(document.all)e = event; var id = this.id; if(this.id=='arrow_right'){ slideSpeedMultiply = Math.floor((e.clientX - this.offsetLeft) / 5); slideSpeed = -1*slideSpeedMultiply; slideSpeed = Math.max(-10,slideSpeed); }else{ slideSpeedMultiply = 10 - Math.floor((e.clientX - this.offsetLeft) / 5); slideSpeed = 1*slideSpeedMultiply; slideSpeed = Math.min(10,slideSpeed); if(slideSpeed<0)slideSpeed=10; } } function releaseSlide() { var id = this.id; slideSpeed=0; } function gallerySlide() { if(slideSpeed!=0){ var leftPos = imageGalleryObj.offsetLeft; leftPos = leftPos/1 + slideSpeed; if(leftPos>maxGalleryXPos){ leftPos = maxGalleryXPos; slideSpeed = 0; } if(leftPos<minGalleryXPos){ leftPos = minGalleryXPos; slideSpeed=0; } imageGalleryObj.style.left = leftPos + 'px'; } setTimeout('gallerySlide()',20); } function showImage() { if(activeImage){ activeImage.style.filter = 'alpha(opacity=50)'; activeImage.style.opacity = 0.5; } this.style.filter = 'alpha(opacity=100)'; this.style.opacity = 1; activeImage = this; } function initSlideShow() { document.getElementById('arrow_left').onmousemove = startSlide; document.getElementById('arrow_left').onmouseout = releaseSlide; document.getElementById('arrow_right').onmousemove = startSlide; document.getElementById('arrow_right').onmouseout = releaseSlide; imageGalleryObj = document.getElementById('theImages'); imageGalleryLeftPos = imageGalleryObj.offsetLeft; var galleryContainer = document.getElementById('galleryContainer'); imageGalleryWidth = galleryContainer.offsetWidth - 20; maxGalleryXPos = imageGalleryObj.offsetLeft; minGalleryXPos = imageGalleryWidth - document.getElementById('slideEnd').offsetLeft; if (navigator.userAgent.indexOf('MSIE') >= 0) { var arrowWidth = document.getElementById('arrow_left').offsetWidth; var el = document.createElement('div'); el.style.position = 'absolute'; el.style.left = arrowWidth + 'px'; el.style.width = (galleryContainer.offsetWidth - arrowWidth * 2) + 'px'; el.style.overflow = 'hidden'; el.style.height = '100%'; document.getElementById('galleryContainer').appendChild(el); el.appendChild(document.getElementById('theImages')); } var slideshowImages = imageGalleryObj.getElementsByTagName('IMG'); for(var no=0;no<slideshowImages.length;no++){ slideshowImages[no].onmouseover = showImage; } var divs = imageGalleryObj.getElementsByTagName('DIV'); for(var no=0;no<divs.length;no++){ if(divs[no].className=='imageCaption')imageGalleryCaptions[imageGalleryCaptions.length] = divs[no].innerHTML; } gallerySlide(); } function showPreview(imagePath,imageIndex){ var subImages = document.getElementById('previewPane').getElementsByTagName('IMG'); if(subImages.length==0){ var img = document.createElement('IMG'); document.getElementById('previewPane').appendChild(img); }else img = subImages[0]; if(displayWaitMessage){ document.getElementById('waitMessage').style.display='inline'; } document.getElementById('largeImageCaption').style.display='none'; img.onload = function() { hideWaitMessageAndShowCaption(imageIndex-1); }; img.src = imagePath; } function hideWaitMessageAndShowCaption(imageIndex) { document.getElementById('waitMessage').style.display='none'; document.getElementById('largeImageCaption').innerHTML = imageGalleryCaptions[imageIndex]; document.getElementById('largeImageCaption').style.display='block'; } window.onload = initSlideShow; 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.. Trying to build a timer for an image array, it works, I've created also a stopTimer on hover event. But, what I wish to do Is create buttons so the users can press previous or next and see the sliding images as they wish. here'S my code so far : <script type="text/javascript"> var currPic=1; var totPics=8; var keepTime; function setupPicChange() { keepTime=setTimeout("changePic()", 15000); } function changePic() { currPic++; if(currPic>totPics) currPic=1; document.getElementById("picture").src="/images/services/picture"+currPic+".png"; setupPicChange(); } function stopTimer() { clearTimeout(keepTime); } function startTimer() { keepTime=setTimeout("changePic()", 5000); } function prevTimer() { currPic-1 } function nextTimer() {currPic+1} </script> I've created the nextTimer and prevTimer functions but they do not seem to work. I do not know how to integrated these functions in CSS sor my button, which are designed with CSS hover, down and active states... can you guys help me out ? am pretty basic here with codes... i am trying to achieve a JS driven button for a cms. for example i have a text in a textarea so i select the text and add the bold attribute to this text. my text before : text my text with bold added : <b>text</b> what the function to achieve this ? thanks hello everyone I am working on a quiz which marks the user and displays to different screens when the total has been calculated. If the user gets over 80% a congratulations page is shown but if you score less your told to go back and look at some of the material again. I would like the congratulations page to show a button to let the users continue on to the next section of the tutorial. Does any one have any ideas how I could do this? im stumped. I have inserted the code below, any help would be much appreciated as I'm a little stuck :/ Code: // Function to create arrays. function makeArray(len) { for (var i = 0; i < len; i++) this[i] = null; this.length = len; } // creates objects for this question. function makeQuestion(question, correctAnswer) { var args = makeQuestion.arguments; this.question = question; this.correctAnswer = correctAnswer; this.userAnswer = null; this.isCorrect = isCorrect; this.showForm = showForm; this.userChoices = new makeArray(args.length - 2); for (var i = 0; i < args.length - 2; i++) { this.userChoices[i] = args[i + 2]; } } // determins if the questions answered correctly function isCorrect() { if (this.correctAnswer == this.userAnswer) return true; else return false; } // Method to display contents of question object. function showForm(n) { //argument n is the number of the question. document.write((n + 1) + '. ' + this.question + '<BLOCKQUOTE><FORM>'); //n+1 = the number of the question in the array (has to add one because the array starts with 0 or the first question would be number 0, this question displays the questions text, blockquote off sets the answer making them indented. for (var i = 0; i < this.userChoices.length; i++) { //goes through the questions one by one. document.write('<INPUT TYPE = "RADIO" NAME = "q' + n + //create the radio buttons. '" onClick = "quiz[' + n + '].userAnswer = ' + i + '">'); document.write(this.userChoices[i] + '<BR>'); } document.write('</FORM></BLOCKQUOTE>'); } // This corrects the quiz, dispays the correct answers and the score. function correctQuiz() { var correct = 0; // sets the correct page to a score of zero correctPage = '<HTML><TITLE>Corrections</TITLE><BODY BGCOLOR = "#FFFFFF">'; // sets the attributes of the correction page for (var i = 0; i < quiz.length; i++) { //loop runs through questions if (quiz[i].isCorrect()) correct++; // the is correct starts at 0 every time is correct returns true (an answer is correct) it adds 1 to the number adding up correct answers. } var score = Math.round((correct / quiz.length) * 100); // find out the % of correct answers by using math and the % equation correctPage += 'Sco <STRONG>' + score + '</STRONG> %'; if (correct < (quiz.length / 100) * 80) { //if the correct number is less than the quiz length then not all the answers were correct if it is the same then all ansers were correct. correctPage += ifWrong; // if there were wrong answers for (var i = 0; i < quiz.length; i++) { // starts a for loop through the answers if (!quiz[i].isCorrect()) { // if quiz doesn't = to iscorrect. correctPage += (i + 1) + '. ' + // this shows what number was wrong. quiz[i].userChoices[quiz[i].correctAnswer] + '<BR>'; // displays the correct answes for the questions that were wrong } } } else correctPage += ifAced; // this is the correct page displayed if all the answers were right. correctPage += '</BODY></HTML>'; // opens the window of correct page correctwin = window.open ('', '', 'height=300,width=300,scrollbars=yes'); if (correctwin.opener == null) correctwin.opener = window; correctwin.location = 'javascript:opener.correctPage'; } // Message to display if quiz is aced. var ifAced = "<P>Well done! you have passed the test. You can now move on to the next section of the tutorial<P>"; // Message to display if any are wrong. var ifWrong = "<P>Check below to see the answers that you got wrong. It maybe helpful if you go back and read the bits your unsure of.<P>"; // Create seven question objects... quiz = new makeArray(8); // this is how many questions there is in the quiz quiz[0] = new makeQuestion("What is the correct name for the leg marking found in picture 1?", // 1st question starts at 0 because thats the first number in an array 2, // correct answer "Sock", // choice 0 "Stocking", // choice 1 "Coronet band", // choice 2 "half cannon"); // choice 3 quiz[1] = new makeQuestion("What is the correct name for the leg marking found in picture 2?", // 2nd question 0, // correct answer "Sock", // choice 0 "Stocking", // choice 1 "Coronet band", //choice 2 "half cannon"); //choice 3 quiz[2] = new makeQuestion("What is the correct name for the leg marking found in picture 3?", 1, // correct answer "Sock", // choice 0 "Stocking", // choice 1 "Coronet band", //choice 2 "half cannon"); quiz[3] = new makeQuestion("What is the correct name for the leg marking found in picture 4?", 3, // correct answer "Sock", // choice 0 "Stocking", // choice 1 "Coronet band", //choice 2 "half cannon"); quiz[4] = new makeQuestion("What is the correct name for the face marking found in picture 5?", 2, "Bald", "Star", "Snip", "Blaze"); quiz[5] = new makeQuestion("what is the correct name for the face marking found in picture 6?", 0, "Bald", "Star", "Snip", "Blaze"); quiz[6] = new makeQuestion("what is the correct name for the face marking found in picture 7?", 3, "Bald", "Star", "Snip", "Blaze"); quiz[7] = new makeQuestion("what is the correct name for the face marking found in picture 8?", 1, "Bald", "Star", "Snip", "Blaze"); i got javascripts button : Code: <input type="button" value="select" onClick="document.getElementById('input').select()" /> how can i transform "button" to image button (gif) Hello, I am trying to implement a radio button option so that users can search specific sites such as google, yahoo, or bing from input box. Here's my code. Please help. <script type="text/javascript"> <!-- function goSearch(){ //search according to checked radio button } --> </script> <h1>Search Option</h1><br /> <input type="radio" name="search" id="google"/><a href="http://www.google.com" rel="nofollow" target="_blank"><img src="images/google.jpg" /></a> <input type="radio" name="search" id="yahoo"/><a href="http://www.yahoo.com" rel="nofollow" target="_blank"><img src="images/yahoo.jpg" /> </a> <input type="radio" name="search" id="bing" /><a href="http://www.bing.com" rel="nofollow" target="_blank"><img src="images/bing.jpg" /> </a> <br /><br /> <form method="get" action="goSearch()" rel="nofollow" target="_blank"> <div style="border:1px solid black;padding:4px;width:20em;"> <table border="0" cellpadding="0"> <tr> <td> <input type="text" name="q" size="25" maxlength="255" value="" /> <input type="submit" value="Search" /> </td> </tr> </table> </div> </form> Hey everyone I want to go ahead and say my issue with javascript is in a homework assignment so...I'm just looking to get more of a nudge in the right direction of how to fix this issue than anything ^^' I'm not asking to have the code fixed for me. I've been assigned to code a simple currency converter of just US dollars to a few other kinds of currency. I have most of the basic stuff done, I used an example piece of javascript and am editing it to try and make it into what I need. I'm just having issues with the button that is supposed to run the function and output the value of the currency, I can't seem to get the button to work. Here is the code I've gotten so far, if someone could just point out maybe where the issue is as sort of a hint I'd be really grateful! Code: <html> <head> <title>Currency Converter</title> <script type = "text/javascript"> function calcvalue() { if (CurrencyType == "USDollars") {price = 1;} if (CurrencyType == "BritishPounds") {price = 0.632766;} if (CurrencyType == "Euros") {price = '.709723';} if (CurrencyType == "CanadianDollars") {price = 0.970476;} if (CurrencyType == "JapaneeseYen") {price = 83.073;} if (CurrencyType == "ChineeseYuan") {price = 6.55649; Currency.answer.value=price*DollarAmount; } if (!( DollarAmount >= 1001 || DollarAmount <= 0)) { alert ("Please Enter a value between 1 and 1000"); return; } } </script> <body> <body bgcolor="CCCCFF"> <form name="Currency"> <center> <table> <tr> <td>Currency Type: </td> <td> <select name="Currency"> <option value="USDollars">US Dollars</option> <option value="BritishPounds">British Pounds</option> <option value="Euros">Euros</option> <option value="CanadianDollars">Canadian Dollars</option> <option value="JapaneeseYen">Japaneese Yen</option> <option value="ChineeseYuan">Chineese Yuan</option> </select> <tr> <td>Dollar Amount</td> <td> $<input type=parsefloat() value="1" name="DollarAmount" size=3></td> </tr> <tr> <td> </td> <td><p class="submit"> <input type=button value="Convert" onclick=calcvalue()></p></td> </tr> <tr> <td>value:</td> <td><input type=text size=6 name="answer"><td> </tr> </table> </center> </form> </body> </html> Good afternoon. I'm trying to make it so a 'radio button' in a 'form' will 'collapse' a Div that I have hidden. I'm using the JavaScript to control the collapse, and google's Jquery for the rest of it. here's the code. Code: <head> <script type="text/javascript" src="SpryAssets/collapse.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> animatedcollapse.addDiv('test', 'fade=1, group=test, speed=400') animatedcollapse.ontoggle=function($, divobj, state) { //fires each time a DIV is expanded/contracted //$: Access to Jquery //divobj: DOM reference to DIV being expanded/collapsed. Use "divobj.id" to get the ID. //state: "block" or "none", depending on the state. } animatedcollapse.init() </script> </head> and the body code... Code: <form action="myform.php" method="post"> <a id="collapsable" href="javascript:animatedcollapse.toggle('test')"> [+] Testing the Collapsability of this Scripting.</a> <div id="test" style="display:none;"> <h1> You can see that if you toggle the 'Image Display' Button. This will display Properly.</h1> </div> </form> You can find a completely working version (When not using Radio buttons and forms) located at My Toggle Works Here. Alternatively, you can find the NON working version, which is what I'm attempting to get to work, located at My Toggle Doesn't Work. you can see that in the version that doesn't work, if you hit the 'Radio button', it will collapse, and immediately uncollapse the Div, I don't get why it does this. Any help is greatly appreciated. |