JavaScript - I Need Help With An On Air Script For A Radio Station Website.
Similar TutorialsI am trying to post a new radio station website which is launching on July 4th.. the template I am using has a JS file and it is foreign to me. http://www.sendspace.com/file/7qd8vd there is the file. Any help would be wonderful. If you figure it out, feel free to send the file to eric@vipradiochico.com. I tried posting the JS file on here but I had to upload it to sendspace. Thanks! Hey, I'm looking for a scrupt that looks at the current day and time and displays the relevant text such as "Breakfast Show DJ" between 6 and 10am on weekdays, "Drive Time DJ" between 5 - 8pm, "Sunday Breakfast" Sundays 6-10am, etc etc. Does anyone know of any links to download such one from, or could possibly post one? I got a bit of stick when asking for someone to post one before, so please if you're not gonna post one, help me out? I could just stick to using the php shoutcast radio stats, but I'd prefer that the on air dj name change to what the schedule shows. Don't ask why, it's just me trying out new things. So please can someone help me out? Many Thanks! Hi I was helped to find the example below to show which presenter is on air now to be displayed on my website. At the moment this displays: DJ Name DJ Photo What I would like it to display is: DJ Name DJ Description DJ Photo Can anyone tell me how to achieve this? Code: function display() { var show = "No show scheduled at present"; var GMToffset = -0; // Your current GMT offset, whether Standard or Daylight var now = new Date(); var dy = now.getDay(); // day of week 0-6 now.setHours(GMToffset + now.getHours() + now.getTimezoneOffset() / 60); var hh = now.getHours(); var mn = now.getMinutes(); hh = hh + (mn/60); // minutes expressed as fractions of an hour // The GMT offset ensures that every visitor, regardless of their timezone, will see the schedule // that is appropriate for the site owner's local time. // Tip - for testing purposes you can put here //dy = 5; //hh = 9.25; // or whatever to check that the right show appears at that day/time. if (dy >=1 && dy <=4) { // days in Javascript are 0 Sunday - 6 Saturday if (hh >=0 && hh <7) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=7 && hh <11) {show = "DJ1"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=11 && hh <14) {show = "DJ2"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=14 && hh <19) {show = "DJ3"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=19 && hh <22) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=22 && hh <=23) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} } if (dy == 5) { if (hh >=0 && hh <7) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=7 && hh <11) {show = "DJ1"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=11 && hh <14) {show = "DJ2"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=14 && hh <19) {show = "DJ3"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=19 && hh <=23) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} } if (dy == 6) { // Saturday Note the two = signs to mean equals if (hh >=0 && hh <8) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=8 && hh <12) {show = "DJ3"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=12 && hh <14) {show = "DJ2"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=14 && hh <18) {show = "DJ4"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=18 && hh <20) {show = "DJ5"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=20 && hh <=23) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} } //End of Saturday Shows if (dy == 0) { //Sunday Shows if (hh >=0 && hh <8) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=8 && hh <12) {show = "DJ4"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=12 && hh <16) {show = "DJ6"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=16 && hh <19) {show = "DJ7"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=19 && hh <22) {show = "DJ7"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} if (hh >=22 && hh <=23) {show = "DJ0"; document.getElementById("theImage").src = "3trfm_template/presenters/xxx.png"} } // End of Sunday Shows var a = "" + show + " \u00A0 \u00A0 \u00A0 \u00A0 "; // spaces must be separted by Unicode spaces to prevent collapse document.getElementById("dj").innerHTML = a; setTimeout("display()", 60000); // update every 60 seconds } Hi, I've used this site before and grabbed the code for the 'On Air Now' which displays the current DJ etc. I've managed to get to grips with the javascript code and used the vars to create DJ descriptions and additionally time too. However, I am struggling with displaying the image in a DIV tag. What am I doing wrong here? Code: <script> $(document).ready(function() { $("dj").load("a"); var refreshId = setInterval(function() { $("dj").load('a?randval='+ Math.random()); }, 60000); $.ajaxSetup({ cache: false }); }); </script> <script type = "text/javascript"> function display() { var show = "No show scheduled at present"; var desc = ""; var DJdesc = []; DJdesc[1] = "Non stop music to get you through the early hours"; DJdesc[2] = "Early riser or insomniac, we keep the hits playing"; DJdesc[3] = "Jump start your day with Today's Best Mix!" DJdesc[4] = "We keep the hits playing while you're at work! Send us a request on Twitter @tmrextra or find us on facebook" DJdesc[5] = "The biggest hits from The Mix Radio Extra's playlist on your ride home" DJdesc[6] = "Today's Best Mix... Old Skool Anthems, Hit Music & Classic Hits" DJdesc[7] = "Wind down after another busy day with Extra Goes Quiet playing the best selection of cool and relaxing music." DJdesc[8] = "The biggest dancefloor fillers of all time" var on = ""; var DJon = []; DJon[1] = "12am - 5am"; DJon[2] = "5am - 7am"; DJon[3] = "7am - 10am" DJon[4] = "10am - 4pm" DJon[5] = "4pm - 7pm" DJon[6] = "7pm - 11pm" DJon[7] = "11pm - 12am" DJon[8] = "7pm - 12am" DJon[9] = "10am - 7pm" DJon[10] = "10am - 11pm" // and so on var GMToffset = 0; // Your current GMT offset, whether Standard or Daylight var now = new Date(); var dy = now.getDay(); // day of week 0-6 now.setHours(GMToffset + now.getHours() + now.getTimezoneOffset() / 60); var hh = now.getHours(); var mn = now.getMinutes(); hh = hh + (mn/60); // minutes expressed as fractions of an hour // The GMT offset ensures that every visitor, regardless of their timezone, will see the schedule // that is appropriate for the site owner's local time. // Tip - for testing purposes you can put here //dy = 5; //hh = 9.25; // or whatever to check that the right show appears at that day/time. //Monday to Thursday if (dy >=1 && dy <=4) { // days in Javascript are 0 Sunday - 6 Saturday if (hh >=0 && hh <5) {show = "Extra at Night"; desc = DJdesc[1]; on = DJon[1]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=5 && hh <7) {show = "Extra Early"; desc = DJdesc[2]; on = DJon[2]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=7 && hh <10) {show = "Extra in the Morning"; desc = DJdesc[3]; on = DJon[3]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=10 && hh <16) {show = "Extra Hits"; desc = DJdesc[4]; on = DJon[4]; document.getElementById("image").src = "images/hits.jpg";} if (hh >=16 && hh <19) {show = "Extra's Ride Home"; desc = DJdesc[5]; on = DJon[5]; document.getElementById("image").src = "images/home.jpg";} if (hh >=19 && hh <23) {show = "Extra Hits"; desc = DJdesc[6]; on = DJon[6]; document.getElementById("image").src = "images/hits.jpg";} if (hh >=23 && hh <24) {show = "Extra Goes Quiet"; desc = DJdesc[7]; on = DJon[7]; document.getElementById("image").src = "images/egq.jpg";} } //Friday if (dy >=5 && dy <=5) { if (hh >=0 && hh <5) {show = "Extra at Night"; desc = DJdesc[1]; on = DJon[1]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=5 && hh <7) {show = "Extra Early"; desc = DJdesc[2]; on = DJon[2]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=7 && hh <10) {show = "Extra in the Morning"; desc = DJdesc[3]; on = DJon[3]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=10 && hh <16) {show = "Extra Hits"; desc = DJdesc[4]; on = DJon[4]; document.getElementById("image").src = "images/hits.jpg";} if (hh >=16 && hh <19) {show = "Extra's Ride Home"; desc = DJdesc[5]; on = DJon[5]; document.getElementById("image").src = "images/home.jpg";} if (hh >=19 && hh <24) {show = "Club Classics"; desc = DJdesc[8]; on = DJon[8]; document.getElementById("image").src = "images/clubclassix.png";} } //Saturday if (dy >=6 && dy <=6) { if (hh >=0 && hh <5) {show = "Extra at Night"; desc = DJdesc[1]; on = DJon[1]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=5 && hh <7) {show = "Extra Early"; desc = DJdesc[2]; on = DJon[2]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=7 && hh <10) {show = "Extra in the Morning"; desc = DJdesc[3]; on = DJon[3]; document.getElementById("image").src = "images/nonstop.png";} if (hh >=10 && hh <19) {show = "Extra Hits: Weekend"; desc = DJdesc[4]; on = DJon[9]; document.getElementById("image").src = "images/weekend.jpg";} if (hh >=19 && hh <24) {show = "Club Classics"; desc = DJdesc[8]; on = DJon[8]; document.getElementById("image").src = "images/clubclassix.png";} } //Sunday if (dy >=7 && dy <=7) { if (hh >=0 && hh <5) {show = "Extra at Night"; desc = DJdesc[1]; on = DJon[1];} if (hh >=5 && hh <7) {show = "Extra Early"; desc = DJdesc[2]; on = DJon[2];} if (hh >=7 && hh <10) {show = "Extra in the Morning"; desc = DJdesc[3]; on = DJon[3];} if (hh >=10 && hh <23) {show = "Extra Hits: Weekend"; desc = DJdesc[4]; on = DJon[10];} if (hh >=23 && hh <24) {show = "Extra Goes Quiet"; desc = DJdesc[7]; on = DJon[7];} } var a = "" + show + " \u00A0 \u00A0 \u00A0 \u00A0 "; // spaces must be separted by Unicode spaces to prevent collapse document.getElementById("dj").innerHTML = a; document.getElementById("DJdescription").innerHTML = desc; document.getElementById("DJon").innerHTML = on; setTimeout("display()", 60000); // update every 60 seconds } </script> </head> <body onload = "display(dj,DJdescription,image)"> <div id="apDiv4"></div> <div id="image"></div> </div> <div id="apDiv27"><span class="style8" id="dj"></span></div> I originally tried using the following inside the div tag but it would only display the src'd item... Code: <div id="image"><img id="image" src="images/nonstop.png"></div></div> Any advice please? This has been racking my brains for a good week now. Thank you Reply With Quote 12-14-2014, 01:03 AM #2 Old Pedant View Profile View Forum Posts Supreme Master coder! Join Date Feb 2009 Posts 28,311 Thanks 82 Thanked 4,754 Times in 4,716 Posts You used id="image" TWICE! IDs *must* be unique on a page! You probably then tried to use document.getElementById("image") but that gives you an error because of the duplicate IDs. Hi Guys, I was wondering if I could have some help. Its coding for the left side of a frame set to display in the right side. Im pulling my hair out! Thanks Code: <html> <head> <script type="text/javascript"> function go() { var go="none"; if (document.buttons.option[0].checked) go=button.option[0].value; if (document.buttons.option[1].checked) go=buttons.option[1].value; if (document.buttons.option[2].checked) go=buttons.option[2].value; parent.rightframe.location=go; } </script> </head> <body> <form name="buttons" id="buttons"> <input type="radio" name="option" value="cit.html" checked="checked">CIT</input> <br /> <input type="radio" name="option" value="currency.html">Currency</input> <br /> <input type="radio" name="option" value="staffsurvey.html">Staff Survey</input> <br /> <input type="radio" name="option" value="game.html">Game</input> <br /> <input type="button" value="Go" onClick="go();"</input> </form> </body> </html> I have the following code: Quote: <form id="registration" action="/cgi-bin/registration.cgi" method="POST" onsubmit="return control()"> <fieldset> <legend>Fill up this module</legend> Private <input id="private" type="radio" name="type" value="private" onclick="return addPrivate()"/><br/> Community/Organization <input id="organization" type="radio" name="type" onclick="alert('Organization')"/><br/> <br/> and the following script: Quote: addPrivate() { alert('Private'); } but alert windows doesn't not appear. Where is the problem? i have written a short script that outputs to: Your hobby is: undefined. Could someone please have a look at the script. I think, i wrote a standard script that deals with radio buttons. Thank you very much <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Form 2 -Javascript</title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <script src="js/test.js" type="text/javascript"></script> </head> <body> <form id="info" action="" method="post"> Reading<input type="radio" name="hobby" value="male"/> Gardening:<input type="radio" name="hobby" value="female"/> <input type="submit" name="submit" value="Submit"/> </form> </body> </html> EXTERNAL STYLE SHEET: function output() { document.getElementById("info").onsubmit=function (){ var hobby=document.getElementById("info").hobby.value; document.write("<strong>Your hobby is:</strong>"+ hobby); } } window.onload=output; How can I make a link or banner to be hidden after x clicks on it? And if possible to count only different IP clicks? Like if 30 users click on the banner and it is no longer shown in the site, unless I put some more clicks for it. Can you please help me, I will really appreciate this.
Hi everyone. For few days I'm looking for how to do this pop-up script when the website is full loaded and then it appears with a darker screen like in this link: http://www.magesy.eu/ - you can see what i'm talking about. But I want to customize it with my own design and functions. There is anyway on the net I can see a guide how to do it!? Thanks for all the helps! Hello, I have to print my cell phone call records but unfortunately my wireless provider displays the number I called only when mouse is hovered over Call details. I have 470 call records and copy pasting all those numbers when mouse is hovered over it will be one hell of a task. Is there any way I could save all the information related to Called Number and do not have to move my mouse for each and every number? Using my basic programming understanding (Though I know nothing about javascript), they are using some mouseover function that displays this information. The possibility of this information to be on the server is less because this information is even available when I switch off my wireless. I can paste that portion of the code if someone needs it to help me out. Saving this website using normal "Save as" does not save the required information. Is there any other way I can save this website will all its details or somehow disabling this mouseover function so that call details are not hidden anymore. Regards, Scoobydoo woundering if any could point me in the right direction, where i can find a soul tree canculator script or any one who can make one. thanks shaun. Hey there! I'm having a bit of a problem with this site I'm workin' on... I am trying to incorporate a website slider (http://tympanus.net/codrops/2010/06/...g-with-jquery/), so when you click the links in my naviagtion, it slides right (horizontally) to a new page, however, with the slider/scroller script in there, the navigation stops working! Here is the link to this page and my code: http://goatsy.me/motoring/ Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="description" content="Website Horizontal Scrolling with jQuery" /> <meta name="keywords" content="jquery, horizontal, scrolling, scroll, smooth"/> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>High Style Motoring - Scooters, Pit Bikes, Atv's, Mopeds, Parts and more!</title> <link rel="stylesheet" href="example/css/website.css" type="text/css" media="screen"/> <!--[if lte IE 6]> <style type="text/css"> /* Internet Explorer 6 PNG transparency fix */ #rotatescroll .overlay { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="example/images/bg-rotatescroll.png", sizingmethod='scale'); } #rotatescroll .thumb { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="example/images/bg-thumb.png", sizingmethod='scale'); } </style> <![endif]--> <script type="text/javascript" src="example/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="example/js/jquery.tinycircleslider.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#rotatescroll').tinycircleslider({ interval: true, snaptodots: true }); }); </script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="description" content="Awesome Bubble Navigation with jQuery" /> <meta name="keywords" content="jquery, circular menu, navigation, round, bubble"/> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/> <style> *{ margin:0; padding:0; } body{ font-family: "Trebuchet MS", sans-serif; background:#fff url(images/bg_scoot1.png) no-repeat top left; padding:20px; } .title{ width:548px; height:169px; position:absolute; top:300px; left:300px; background:transparent url(title.png) no-repeat top left; } a.back{ background:transparent url(back.png) no-repeat top left; position:fixed; width:150px; height:27px; outline:none; bottom:0px; left:0px; } #content{ margin:0 auto; } </style> </head> <body> <div id="wrap"> <div id="rotatescroll"> <div class="viewport"> <ul class="overview"> <li><a href="#"><img src="example/images/scoot_gray.png" /></a></li> <li><a href="#"><img src="example/images/scoot_red.png" /></a></li> <li><a href="#"><img src="example/images/scoot_green.png" /></a></li> <li><a href="#"><img src="example/images/scoot_atv.png" /></a></li> <li><a href="#"><img src="example/images/scoot_pit.png" /></a></li> </ul> </div> <div class="dot"></div> <div class="overlay"></div> <div class="thumb"></div> </div> <div id="content"> <a class="back" href="#"></a> <div class="title"></div> <div class="navigation" id="nav"> <div class="item user"> <img src="images/bg_user.png" alt="" width="199" height="199" class="circle"/> <a href="#" class="icon"></a> <h2>Home</h2> <ul class="nav"> <li><a href="#section1">About Us</a></li> <li><a href="#services">Services</a></li> <li><a href="#contact">Contact</a></li> </ul> </div> <div class="item home"> <img src="images/bg_home.png" alt="" width="199" height="199" class="circle"/> <a href="#" class="icon"></a> <h2>Bikes</h2> <ul> <li><a href="#scooter">Scooter</a></li> <li><a href="#moped">Moped</a></li> <li><a href="#atv">ATV / Pit</a></li> </ul> </div> <div class="item shop"> <img src="images/bg_shop.png" alt="" width="199" height="199" class="circle"/> <a href="#" class="icon"></a> <h2>Shop</h2> <ul> <li><a href="#">Catalog</a></li> <li><a href="#">Offers</a></li> <li><a href="#">Order Now</a></li> </ul> </div> <div class="item camera"> <img src="images/bg_camera.png" alt="" width="199" height="199" class="circle"/> <a href="#" class="icon"></a> <h2>Photos</h2> <ul> <li><a href="#">Bikes</a></li> <li><a href="#">Helmets</a></li> <li><a href="#">Acc.</a></li> </ul> </div> <div class="item fav"> <img src="images/bg_fav.png" alt="" width="199" height="199" class="circle"/> <a href="#" class="icon"></a> <h2>Extra</h2> <ul> <li><a href="#">Dream Bike</a></li> <li><a href="#">FAQ / Info</a></li> <li><a href="#">Comments</a></li> </ul> </div> </div> </div> <!-- The JavaScript --> <script type="text/javascript" src="jquery.easing.1.3.js"></script> <script type="text/javascript"> $(function() { $('#nav > div').hover( function () { var $this = $(this); $this.find('img').stop().animate({ 'width' :'199px', 'height' :'199px', 'top' :'-25px', 'left' :'-25px', 'opacity' :'1.0' },500,'easeOutBack',function(){ $(this).parent().find('ul').fadeIn(700); }); $this.find('a:first,h2').addClass('active'); }, function () { var $this = $(this); $this.find('ul').fadeOut(500); $this.find('img').stop().animate({ 'width' :'52px', 'height' :'52px', 'top' :'0px', 'left' :'0px', 'opacity' :'0.1' },5000,'easeOutBack'); $this.find('a:first,h2').removeClass('active'); } ); }); </script> <div class="section black" id="section1"> <h2>ABOUT US</h2> <p> HIGH STYLE MOTORING A constant commitment to quality, service, and customer satisfaction. We are a family owned and operated dealership doing business at our present location since 1987. It is important to note that we are a fully licensed and bonded California new motorcycle dealership (Dealer # 11080) and operating a full service brick and mortar establishment dedicated to serving the needs of the most discriminating customer. This is important as it sets us far apart from most of the "on-line" businesses that really don't have the proper knowledge or understanding of the products they sell. Here at HIGH STYLE MOTORING we are dedicated to not just the sale, but have a full service repair facility as well as one of the most extensive parts inventories available. Over the last 23 years we have helped literally thousands of customers find the Scooter, Pit Bike, ATV or vehicle that best fit their style and budget. We will be more than happy to help you as well! YIPPEE! Huge selection in stock and ready to take home. NATIONWIDE delivery is also available on each unit that we sell and you can rest assured knowing that your new vehicle will be delivered promptly right to your door ANYWHERE in the USA! It's for these reasons that we sell absolutely more Scooters, Pit Bikes, ATV's and other vehicles than ANYONE in the entire area! Check us out - we're here all day long saving you big $$$on the product that fits your style. Retro's, Cruisers, Freeway Scoots, ATV's and the complete line-up of SSR Pit Bikes are all in stock and ready for delivery - RIGHT NOW! We can also hand deliver your products anywhere in the Orange County or Los Angeles areas. Please give us a call at (562) 945-8361. We also accept most major credit cards. Stop by and say 'Hi' and let us help you to start saving money TODAY! </p> </div> <!-- The JavaScript --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="jquery.easing.1.3.js"></script> <script type="text/javascript"> $(function() { $('ul.nav a').bind('click',function(event){ var $anchor = $(this); /* if you want to use one of the easing effects: $('html, body').stop().animate({ scrollLeft: $($anchor.attr('href')).offset().left }, 1500,'easeInOutExpo'); */ $('html, body').stop().animate({ scrollLeft: $($anchor.attr('href')).offset().left }, 1000); event.preventDefault(); }); }); </script> </body> </html> And whenever I take out this part of the code, the navigation starts working again, but the slider totally doesn't work... it turns into a simple/regular page anchor again! D: (The slider doesn't seem to be working either way): Code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> So, any ideas or info would be suuuuper appreciated b/c I've been trying to figure this out and I reallllllly want it to work! I can't seem to figure out what the problem is hurr! :\ 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 ok i need a bit of advice.. I have a webpage and i want to put a section of another website on to my own website.. The Section i want to put on my website is on this page www.bebo.com/thegaadiscos and i only want to put the section with the comments on it... What i want is a bit like the face book section of this website http://www.alexandraburkeofficial.com/ How would this be done does anyone know.. Hi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance Hi, Been trying to figure this code out for some hours now to no avail. I have 2 radio buttons on the page and would like to get the value from the selected button so I can use it for another function. Code: var alpineResort=document.SkiR.Type.checked=true; var alpineResort=parseFloat(alpineResort) if ( ( document.SkiR.Type[0].checked == false ) && ( document.SkiR.Type[1].checked == false ) ) { alert ( "You have no selected any value." ); valid = false; document.SkiR.Type.focus() } I managed to validate it, but puzzled as to how to get the value out of it. Really need some help as its quite urgent! thanks I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js hi can someone help me on my code on javascript sory im a newbie can you check this and help me what i need to do to add all the radio botton and check box. i already finish the add formula on the checkbox but i do not know how to add the two selected radio buttons to my checkbox buttons help please... for example: O selected is 80 O 60 O 60 O selected is 15 O 15 O 25 chkbox 22 chkbox 30 chkbox 8 Code: function Compute(form) { if(form.radio1[0].checked) form.text1.value=form.radio1[0].value; <---- the value of this is 80 else if(form.radio1[1].checked) form.text1.value=form.radio1[1].value; <---- 60 else if(form.radio1[2].checked) form.text1.value=form.radio1[2].value; <---- 60 else if(form.radio1[0].checked) form.text1.value=form.radio1[0].value; <---- 15 else if(form.radio2[1].checked) form.text1.value=form.radio2[1].value; <---- 15 else if(form.radio2[2].checked) form.text1.value=form.radio2[2].value; <---- 25 var a=0; if(form.chk1.checked) <----22 a = a + eval(form.chk1.value); if(form.chk2.checked) <----30 a = a + eval(form.chk2.value); if(form.chk3.checked) <----8 a = a + eval(form.chk3.value); if(form.chk1.checked && form.chk2.checked) a = eval(form.chk1.value) + eval(form.chk2.value); if(form.chk1.checked && form.chk3.checked) a = eval(form.chk1.value) + eval(form.chk3.value); if(form.chk2.checked && form.chk1.checked) a = eval(form.chk2.value) + eval(form.chk1.value); if(form.chk2.checked && form.chk3.checked) a = eval(form.chk2.value) + eval(form.chk3.value); if(form.chk3.checked && form.chk1.checked) a = eval(form.chk3.value) + eval(form.chk1.value); if(form.chk3.checked && form.chk2.checked) a = eval(form.chk3.value) + eval(form.chk2.value); if(form.chk1.checked && form.chk2.checked && form.chk3.checked) a = eval(form.chk1.value) + eval(form.chk2.value) + eval(form.chk3.value); form.text1.value=a; } I've been looking around and all the validation stuff I've seen doesn't work for what I have. Here is what I am trying to do: The user selects the Heads or Tails radio button for the first flip and then selects heads or tails radio button for the 2nd flip. The script then randomly flips two coins and compares it to what the user selected and if they are the same the user wins and if not then they lose. So there would be 4 buttons total, two Heads and two Tails. The first set of Heads and Tails needs to be assigned to "guess1" and the 2nd set is "guess2". So if the user clicks Tails for Flip1 and Heads for Flip2 then Tails is assigned to guess1 and Heads is assigned to guess2. Right now the script just assumes the user is selecting heads for both flips. Code: <html> <head> <title>Guess Two Coin Tosses</title> <script> function flip5(){ //Input var guess1 = document.getElementById('guess1').value var guess2 = document.getElementById('guess2').value var flip1 = Math.floor(Math.random() * 2) var flip2 = Math.floor(Math.random() * 2) var outcomes if (flip1 == 0) flip1 = 'Heads'; else flip1 = 'Tails'; if (flip2 == 0) flip2 = 'Heads'; else flip2 = 'Tails'; //Processing if (flip1.toUpperCase() == guess1.toUpperCase()) { if (flip2.toUpperCase() == guess2.toUpperCase()) outcomes = 'win win'; else outcomes = 'win lose'; } else { // here we lost the first if (flip2.toUpperCase() == guess2.toUpperCase()) outcomes = 'lose win'; else outcomes = 'lose lose'; } //Output document.getElementById('flip1').value = flip1 document.getElementById('flip2').value = flip2 document.getElementById('outcomes').value = outcomes } </script> </head> <body> <h3>Predict the Futu Guess Two Coin Flips</h3> Enter Heads for Heads, Tails for Tails! Case does not matter! <p/>Your Guess for Flip-1: <input type=radio id="guess1" size="5" value="Heads" />Heads <input type=radio id="guess1" size="5" value="Tails" />Tails <p/>Your Guess for Flip-2: <input type=radio id="guess2" size="5" value="Heads" />Heads <input type=radio id="guess2" size="5" value="Tails" />Tails <p/>Flip-1: <input type="text" id="flip1" size="5" value="???" /> <p/>Flip-2: <input type="text" id="flip2" size="5" value="???" /> <p/><input type="button" value="Flip Two!" onclick="flip5()" /> <p/>Outcomes: <input type="text" id="outcomes" size="20" value="" /> <hr> </body> </html> |