JavaScript - Color Coding Wordpress Categories Via Javascript
I'm working on a new custom theme for my WordPress based site, and up until now I've been using the following PHP code to color code links based on whether the post was in the "Wii" category, "Xbox" category, or "PlayStation" category:
PHP Code: <li> <?php if (in_category(3) ) { ?> <a style="color:#990000;" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> <? }elseif (in_category(4) ) { ?> <a style="color:#669900;" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> <? }elseif (in_category(7) ) { ?> <a style="color:#0099cc;" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> <? } else { ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> <? } ?> </li> Thing is, I've now installed a plugin called "Recently Popular" that logs all visits and can output which posts were viewed the most in the past X days/weeks/months/etc. and the author has it set up to only allow HTML formatting via this line: PHP Code: <?php get_recently_popular(1, 'WEEK', 5, 0, 0, '<a href="%post_url%" rel="bookmark" title="%post_title%">%post_title%</a>'); ?> I've tried sticking PHP in the line, but it only takes HTML. I've tried sticking one of these lines in each of the conditional statements above, but realized that this line outputs the entire "Recently Popular" list, not just one item - so everything would end up being the same color still. I contacted the plugin author, who said that without hardcoding there's no way to get around this via the plugin, but that outputting it normally and running it through JavaScript might give me a way to apply CSS styling to it after it's been rendered. I'm not experienced with JavaScript, unfortunately... does anyone know how I can do this? Similar Tutorialshow do i make a wordpress website with tabs to different sub-sections without changing pages, its almost seems like an iframe... example: http://www.alexa.com/siteinfo/google.com [look at the tabbing, and how it doesn't change URL] how can i make it like this using wordpress? is there a plugin? also, i need something that will make an iframe for me [of another website] but make it impossible to click or right-click, BUT can scroll. is there some type of plugin for wordpress that can help me do that? [so i can customize the template of the iframe and the page the holds the iframe] thanks!! (: I am trying to display code on a web page in a readable and formatted fashion with color highlighting idealy. I am assuming that something of this nature would have to be done with javascript to calculate the css styling based on the keywords. Been trying to find something on this for a while but cant find anything Any suggestions would be appreciated part of index page Code: <form id="form1" name="form1" method="get" action="show.php"> <select id="mark" name="mark"> <option value="">--</option> <option value="100">BMW</option> <option value="101">Audi</option> </select> <select id="series" name="series"> <option value="">--</option> <option value="1" class="100">1 series</option> <option value="3" class="100">3 series</option> <option value="5" class="100">5 series</option> <option value="6" class="100">6 series</option> <option value="7" class="100">7 series</option> <option value="11" class="101">A1</option> <option value="23" class="101">A3</option> <option value="33" class="101">S3</option> <option value="44" class="101">A4</option> <option value="54" class="101">S4</option> </select> <button name="" type="submit" > Find! </button> </p> </form> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/jquery.chained.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> $(function() { $("#series").chained("#mark"); }); </script> js Code: (function($) { $.fn.chained = function(parent_selector, options) { return this.each(function() { /* Save this to self because this changes when scope changes. */ var self = this; var backup = $(self).clone(); /* Handles maximum two parents now. */ $(parent_selector).each(function() { $(this).bind("change", function() { $(self).html(backup.html()); var selected = ""; selected = selected.substr(1); /* Also check for first parent without subclassing. */ /* TODO: This should be dynamic and check for each parent */ /* without subclassing. */ var first = $(parent_selector).first(); var selected_first = $(":selected", first).val(); $("option", self).each(function() { /* Remove unneeded items but save the default value. */ if (!$(this).hasClass(selected) && !$(this).hasClass(selected_first) && $(this).val() !== "") { $(this).remove(); } }); /* If we have only the default value disable select. */ if (1 == $("option", self).size() && $(self).val() === "") { $(self).attr("disabled", "disabled"); } else { $(self).removeAttr("disabled"); } $(self).trigger("change"); }); /* Force IE to see something selected on first page load. */ $("option", this).first().attr("selected", "selected"); /* Force updating the children. */ $(this).trigger("change"); }); }); }; /* Alias for those who like to use more English like syntax. */ $.fn.chainedTo = $.fn.chained; })(jQuery); show.php Code: <?php if (isset($_GET['mark'])) { $papar_car=$_GET['mark']; } if (isset($_GET['series'])) { $papar_ser=$_GET['series']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head> <body> <form id="form1" name="form1" method="get" action="show.php"> <select id="mark" name="mark"> <option value="">--</option> <option value="100"<? if($papar_car=="100")echo "selected='selected'"; ?>>BMW</option> <option value="101"<? if($papar_car=="101")echo "selected='selected'"; ?>>Audi</option> </select> <select id="series" name="series"> <option value="">--</option> <option value="1" class="100" <? if($papar_ser=="1")echo "selected='selected'"; ?>>1 series</option> <option value="3" class="100"<? if($papar_ser=="3")echo "selected='selected'"; ?>>3 series</option> <option value="5" class="100"<? if($papar_ser=="5")echo "selected='selected'"; ?>>5 series</option> <option value="6" class="100"<? if($papar_ser=="6")echo "selected='selected'"; ?>>6 series</option> <option value="7" class="100<? if($papar_ser=="7")echo "selected='selected'"; ?>">7 series</option> <option value="11" class="101" <? if($papar_ser=="11")echo "selected='selected'"; ?>>A1</option> <option value="23" class="101" <? if($papar_ser=="23")echo "selected='selected'"; ?>>A3</option> <option value="33" class="101"<? if($papar_ser=="33")echo "selected='selected'"; ?>>S3</option> <option value="44" class="101" <? if($papar_ser=="44")echo "selected='selected'"; ?>>A4</option> <option value="54" class="101"<? if($papar_ser=="54")echo "selected='selected'"; ?>>S4</option> </select> <button name="" type="submit" > Find! </button> </p> </form> <script type="text/javascript" language="javascript"> var car_m= <?php echo $_POST['mark']; ?> </script> <script type="text/javascript" language="javascript"> var car_m_s= <?php echo $_POST['series']; ?> </script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/jquery.chained.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> $(function() { $("#series").chained("#mark"); }); </script> guys, after i done selection in the form1, i press submit button and Im going to show.php page. on show.php page i want categories to be already selected. whats my problem? Hi, I'm faced with a problem trying to set background color under IE7. I have the following Javascript: Code: function showLayer793BKColor(id) { var txtObj = document.all(id); if (txtObj.style.display == 'none') { txtObj.style.display = '' txtObj.style.backgroundColor = 'grey'; } } function hideLayer793BKColor(id) { var txtObj = document.all(id); if ( txtObj.style.backgroundColor == 'grey' ) txtObj.style.display = 'none'; } These functions are used to show or hide div blocks. These blocks are, for example, specified in the following way: Code: <div id="l_gct5tekst" style="display:none"> <b>GCT 5. Eerste verkenning problematiek</b> and, for example, Code: <div id="l_Keuze" style="display:none"> <br/> <b>GCT 5</b> <br/> </div> The whole configuration works smoothly when using IE8. However, when using IE7 I get an error msg like "Invalid value for property". When I use the Color propert iso the BackgroundColor property I get no error anymore but of course I don't have a background color anymore then. In what way can I specify the use of a background color under IE7 ? Or is just not possible in one way or the other. Furthermore, what more differences between JS under IE7 and IE8 do I have to take into account ? Do I also have to rewrite my div block in some way (using some attribs ?) to cope with IE7 ? Thanks in advance, Diederick van Elst hello folks, I start modding on a new theme, that wordpress theme got a javasript that flash news. see the website : Code: http://www.casapost.biz the problem is if i want to put any post or page, in that section, so I have to do it manually, so i have to put the HTML code. My Question is how can I change that probleme, in instead of coping HTML code, just to get post automatically from a category, So any post from that category will be showen as the news flash right now. the javaScript for that file is : Code: <div id="Featured"> <script type="text/javascript"> var delay = 5000; //set delay between message change (in miliseconds) var maxsteps=30; // number of steps to take to change from start color to endcolor var stepdelay=40; // time in miliseconds of a single step //**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect var startcolor= new Array(234,250,255); // start color (red, green, blue) var endcolor=new Array(0,0,0); // end color (red, green, blue) var fcontent=new Array(); begintag='<div style="font: normal 11px Geneva, Arial, Helvetica, sans-serif; padding: 10px;">'; //set opening tag, such as font declarations fcontent[0]="<b>News 1</b><br><br>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis. Aliquamit amet felis. Mauris eros semper, velit semper laoreet dictum, quam diam dictum urna, ec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallist, eros. Aliquam pharetra. Nulla in tellus eget odio sagittis blandit elit semper laoreet dictum, quam diam dictum urna, ec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallist, eros......<br><br>Quisque sed felis. Aliquamit amet felis. Mauris semper, velit semper laoreet dictum, quam diam dictum urna, ec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallist, eros. Aliquam pharetra. Nulla in tellus eget odio sagittis blandit. Maecenas at nisl. ullam lorem mi, eleifend a, fringilla vel, semper at, ligula. Mauris eu wisi. Ut ante ui, aliquet nec, congue non, accumsan sit amet, lectus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit."; fcontent[1]="<b>News 2</b><br><br>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis. Aliquamit amet felis. Mauris eros semper, velit semper laoreet dictum, quam diam dictum urna, ec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallist, eros. Aliquam pharetra. Nulla in tellus eget odio sagittis blandit. Maec at nisl. ullam lorem mi, eleifend a, fringilla vel, semper at, ligula. Mauris eu wisi. Ut ante ui, aliquet neccon non, accumsan sit amet, lectus. Mauris et mauris. Duis sed assa id mauris pretium venenatis. Suspendisse cursus velit vel ligula. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis. Aliquamit amet felis. Mauris semper, velit semper laoreet dictum, quam diam dictum urna, ec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallist, eros. Aliquam pharetra. Nulla in tellus eget odio sagittis blandit. Maecenas at nisl. ullam lorem mi......"; fcontent[2]="<b>News 3</b><br><br> Flash Info</a>"; closetag='</div>'; var fwidth='672px'; //set scroller width var fheight='176px'; //set scroller height var fadelinks=1; //should links inside scroller content also fade like text? 0 for no, 1 for yes. ///No need to edit below this line///////////////// var ie4=document.all&&!document.getElementById; var DOM2=document.getElementById; var faderdelay=0; var index=0; /*Rafael Raposo edited function*/ //function to change content function changecontent(){ if (index>=fcontent.length) index=0 if (DOM2){ document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")" document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag if (fadelinks) linkcolorchange(1); colorfade(1, 15); } else if (ie4) document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag; index++ } // colorfade() partially by Marcio Galli for Netscape Communications. //////////// // Modified by Dynamicdrive.com function linkcolorchange(step){ var obj=document.getElementById("fscroller").getElementsByTagName("A"); if (obj.length>0){ for (i=0;i<obj.length;i++) obj[i].style.color=getstepcolor(step); } } /*Rafael Raposo edited function*/ var fadecounter; function colorfade(step) { if(step<=maxsteps) { document.getElementById("fscroller").style.color=getstepcolor(step); if (fadelinks) linkcolorchange(step); step++; fadecounter=setTimeout("colorfade("+step+")",stepdelay); }else{ clearTimeout(fadecounter); document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")"; setTimeout("changecontent()", delay); } } /*Rafael Raposo's new function*/ function getstepcolor(step) { var diff var newcolor=new Array(3); for(var i=0;i<3;i++) { diff = (startcolor[i]-endcolor[i]); if(diff > 0) { newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step); } else { newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step); } } return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")"); } if (ie4||DOM2) document.write('<div id="fscroller" style="border:1px solid #282828; background: #ffffff; width:'+fwidth+';height:'+fheight+'"></div>'); if (window.addEventListener) window.addEventListener("load", changecontent, false) else if (window.attachEvent) window.attachEvent("onload", changecontent) else if (document.getElementById) window.onload=changecontent </script> </div> Thank you, any help is welcome, i'm noob to this world Hey, I need some help with a javascript code. The code works fine in a HTML editor but produces this error, "HTTP method GET is not supported by this URL" in WordPress. Problem: I can't get this URL: https://www.geonlineapply.com/servlet/MCSGenericApp to function probably in WordPress. Any suggestions would be highly appreciated! Here's the HTML code: <SCRIPT language=javascript>function callSubmit() { document.frmApplicationTermsCond.submit(); } </SCRIPT> <FORM name=frmApplicationTermsCond action=https://www.geonlineapply.com/servlet/MCSGenericApp method=post target="_blank"> <INPUT type=hidden value=N name=MCSCLIENTTEST> <INPUT type=hidden value=OR name=PRODUCTCODE> <INPUT type=hidden value=03 name=GROUPCODE> <INPUT type=hidden value=1290800802 name=MERCHANTNUMBER> <INPUT type=hidden value=http://www.hrirrigation.com name=HOMEURL> <INPUT type=hidden value=TC name=OPERATION> <INPUT type=hidden value=I name=ORIGINATIONCODE> <INPUT type=hidden value=N name=CALLBACKCODE> <INPUT type=hidden value=00 name=FRAMESIZE> <INPUT type=hidden name=DEALERIMG1> <INPUT type=hidden name=DEALERIMG2> <INPUT type=hidden name=DEALERIMG3> <INPUT type=hidden name=BOTTOMFRAME> <INPUT type=hidden name=STORELOCATOR> <INPUT type=hidden value=3E name=APPROVALTEMPLATE> <INPUT type=hidden value=#FFFFFF name=BGCOLOR> <INPUT type=hidden name=DECLINEURL></FORM> <TABLE width="32%" align="center"> <TBODY> <TR> <TD width="100%" colSpan=2> <P align=center><A href="javascript:callSubmit()"><SPAN style="FONT-SIZE: 18px; COLOR: #cc0000">Apply Now I’ve recently bought a Javascript/xml map of the USA. After payment a zip archive could be downloaded that includes a .html file, a .js file and a css stylesheet. Instructions on how to set it up in wordpress were not included though. Basically it comes down to this: every state of the US is clickable. In the .html file the settings can be configured for each state, such as whether the state is active (clickable) or not, and where it should link to. This part i understand and i know how to configure the .html file. The problem is that i can’t implement it on a wordpress page due to my limited programming skills. I tried uploading the .js file in my wp-content folder, and copying the code from index.html to a new page (note that i didn't use the WYSIWYG editor but the HTML option) but it seems like the Javascript file doesn't load. Any help would be greatly appreciated Screenshot of how the map looks like when i open the .html file in my browser (the map is working, i just can't get it to work in Wordpress) Screenshot of the files included in the zip file Thanks in advance Hello, I'm trying to change the background image with a mouseover function on the menu (Center Consoles, etc.). Here's my the page I'm working on (Boats | Striper Boats) When you hover on Center Consoles> 200CC, the background image should change. What am I doing wrong?? My Wordpress template uses this php code to call the background image: PHP Code: <?php /* #Start the Loop ======================================================*/ if (have_posts()) : while (have_posts()) : the_post(); ?> <?php /* #Get Fullscreen Background ======================================================*/ $pageimage = get_post_meta($post->ID,'_thumbnail_id',false); $pageimage = wp_get_attachment_image_src($pageimage[0], 'full', false); ag_fullscreen_bg($pageimage[0]); ?> and here is my code for the Javascript I set up to get the mouseover function and to set up the menu: PHP Code: <script language="JavaScript"> var backImage = new Array(); // don't change this // Note how backImage[3] = "" -- which would // set the page to *no* background image. backImage[0] = "http://takeitto11.com/striper2015/wp-content/uploads/2014/10/Striper_HPS_1500x150010.jpg"; backImage[1] = "22.jpg"; backImage[2] = "33.jpg"; backImage[3] = ""; // Do not edit below this line. //----------------------------- function changeBGImage(whichImage){ if (document.body){ document.body.background = backImage[whichImage]; } } </script> <div class="contentarea"> <div id='cssmenu'> <ul> <li class='has-sub'><a href='#'>Center Consoles</a> <ul> <li class='sub'><a class="rollover" href="http://takeitto11.com/striper2015/portfolio/2oo-cc/" onMouseOver="javascript:changeBGImage(0)">200 CC</a></li> <li class='sub'><a class="220CC" href='#'>220 CC</a></li> <li class='sub'><a class="2605CC" href='#'>2605 CC</a></li> </ul> </li> <li class='has-sub '><a href='#'>Dual Consoles</a> <ul> <li class='sub'><a class="200DC" href='#'>200 DC</a></li> <li class='sub'><a class="220DC" href='#'>220 DC</a></li> </ul> </li> <li class='has-sub '><a href='#'>Walk Arounds</a> <ul> <li class='sub'><a class="200WA" href='#'>200 Walk Around</a></li> <li class='sub'><a class="220WA" href='#'>220 Walk Around</a></li> <li class='sub'><a class="2601WA" href='#'>2601 Walk Around</a></li> <li class='sub'><a class="2901WA" href='#'>2901 Walk Around</a></li> </ul> </li> </div> <div class="clear"></div> </ul> For some reason it's not working. I've already tried jQuery and that ended up with some weird results, please help!! I am wanting a script to find and replace numbers in text it is not working for me so will someone help? I believe that this will work. Code: findAndReplace('(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98)', '(d)'); However, I need the variable a to equal whatever number it finds. (e.g. 27 --> a=27) I have no idea on how to do that These are theformulas that i need it to do Code: var a = _____ var b = 100 - a var c = 17932 % b var d = a + c Dear all, I am new here. Need a bit of help. In my company, we have a form that sends an email to a specific address, which is actually our internal helpdesk ticketing system. What we want to do is to make the address of the internal helpdesk ticket system show the person's email address, which is the Requestor_id as mentioned below. This webpage is running on Frontpage Server Extensions. However, when i insert the script in red and tested it on the server, it says that frontpage cannot send out this form due to some errors. Appreciate any form of assistance... Code: <form method="POST" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript"> <!--webbot bot="SaveResults" startspan S-Email-Format="HTML/BR" B-Email-Label-Fields="TRUE" B-Email-Subject-From-Field="FALSE" S-Email-Subject="ISP Local User Access" S-Builtin-Fields="" U-Confirmation-Url="../../SuccessMessage.htm" U-Validation-Error-Url="../../FailureMessage.htm" S-Email-Address="Reportticket.GlobalServiceDesk@pr1.xxx.com" S-Email-ReplyTo="<script type="text/javascript"> document.getElementById('Requestor_Email').value; </script>" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan i-checksum="43374" --> I have a basic Javascript slideshow that flicks through a series of 6 jpg images very quickly. I also have a button that i need coded so that when a user clicks on the button, the script for the slide show slows down the speed of the flicking images slowly over the coarse of ten seconds and stops on an image. How do i go about coding the button in javascript? I hope this makes sense. Thankyou Here is my code so far. var i, imgs, pic; function rotate() { pic.src=imgs[i]; (i===(imgs.length -1))? i=0:i++; setTimeout(rotate,500); } function diceroll() { pic=document.getElementById("yes"); imgs=["photo1.jpg", "photo2.jpg","photo3.jpg","photo4.jpg","photo5.jpg"]; var preload=new Array(); for(i=0;i<imgs.length;i++) { preload[i]=new Image(); preload[i].src=imgs[i]; } i=0; rotate(); } I am an amateur web designer and could really use your help. I'm working on a test page right now (http://www.piscatawayacres.com/test.html). I'm trying to have 3 effects going on at the same time, but due to my inexperience with Javascript (I, in fact, copied and pasted most of it), I can't get them to work. To complicate things, my test page works to a certain extent, but when I copy and paste the coding to other pages (like alpacas.html, sheep.html, goats.html, etc.) it ceases to work. I have no idea why it does this. The 3 effects I want to have work: 1. Javascript rollover buttons. 2. A Javascript slideshow--the square picture above the buttons should be changing. 3. I want the image and the buttons to follow the user down the page as they scroll. For some reason though, the buttons (on the couple of pages they work at all) cease to work except at the very top of the page or the very bottom, but not in between. I've been struggling with this obstacle for a long time, so I would greatly appreciate any help someone could give. Thanks so much for your help. PAC P.S. I want to emphasize that some of the coding works on the test.html page, but WON'T work when I copy and paste it elsewhere. I can only assume it is because of conflicts with the coding. I know my coding is not flawless.... I have a code that I implemented on my site. I was wondering if there was a way to had an active link within the 'blurb' section? I'm not familiar with Javascript... var blurb = new Array(); blurb[0]="Text 1" blurb[1]="Text 2" blurb[2]="Text 3" blurb[3]="Text 4" blurb[4]="Text 5<br>More text<br>Add a link" blurb[5]="www.link.com" for (i=0; i < aryImages.length; i++) { var preload = new Image(); preload.src = aryImages[i]; } function swap(imgIndex) { document['imgMain'].src = aryImages[imgIndex]; TheText = blurb[imgIndex]; document.getElementById('blurbarea').innerHTML=TheText; } Any help would be great!! I'm not a coder myself but I could use some help and am willing to pay if it's within reason. It's for a site I'm putting together for a hobby of mine. Here's a description of what I need done: http://masterengraver.com/ambigrams/test.html Please drop me an email with price for your time if you can do this. Thanks! / ~Sam Hi Experts, I'm new to this forum and need your help regarding javascript. I am creating a roster for my team with a web interface. Ex: A picture is attached for your reference The time is in IST (+5:30) I have created a drp down list which has PST, EST,CST time. I need to write a code so that whenever I select any of these times (PST,EST,CST, MST, IST) , it should automatically update the table. Please help. Regards, Indy Okay, I am relatively new to Java and am going to be taking a class on it next fall. For now though, I am trying to code for a client I am currently working with and am hopelessly lost. The client I am working with has an ecommerce site with Network Solutions which uses aspx. It allows you to code html and link to css, java (pretty much anything except php). The problem I am having is that they currently have their product descriptions coded in div tags: <div id='alternatebg'> <div id='detailsgreybox'><div id='alternatename'><p>Alternate Name</p></div></div> <div id='pd2'><p>Not Available</p></div> </div> <div id='usebg'> <div id='detailsgreybox'><div id='use'><p>Use</p></div></div> <div id='pd3'><p>Chemicals</p></div> </div> What they want to happen is for the sections that have 'Not Available' as the answer to not show up on the live page. I have tried to use <ns:if condition="..."> but do not know how to call for it to see if the div says 'Not Available'. Any help is greatly appreciated as I can not move forward until I can figure this out. Hi, I'm fairly new to javascript & am trying to learn it using best methods. I have been using various books & some video tutorials, such as lynda.com. I've noticed when I do google searches for example tutorials, 9 times out 10, the javascript has been coded into the html file. As a newbie I find it takes a very long time to redo the coding into the separate .js file. And if the coding is relatively complex (and most of it appears that way to someone new to this) I can't get it too work using a separate file for the javascript. I wanted to ask anyone very familiar with this, their suggestions regarding good places for tutorials where the .js file is separated. Apparently there are advantages to having it separate and it's considered best practices from what I've come to understand. Also most of the results from google searches pulls up out-dated coding and/or tutorials that suggest you should already understand what is being referred too. I'm trying to avoid learning it the wrong way. I'm willing to put in the effort, however I don't want to pick up bad habits. Any help is very appreciated. If this was not as clear as I intended it to be, please ask any specifics and I'll try my best to answer. -Todd Hi, I'm still in the early stages of learning Javascript so I'm not sure how (or if it's possible) to do this. I know HTML, CSS, etc... just not too familiar with Javascript. Here's the deal.... I run a website that features a chat room written in Perl for CGI. The chat room will automatically email a user their password if it's forgotten but there is one issue.....it does not have the "Forgot Password?" link. To achieve the Lost Password page, the user must enter an invalid password FIRST on the login screen, otherwise they cannot get to that option and are often requesting assistance. What I had in mind was an easier way for the user to get their password since new novice members are not sure how to get to the lost password page. I'm not trying to edit the Perl code for the chat, but I wanted to build a "Forgot Password?" page using a Javascript code that will automatically take their username from the "username" login field and direct them to the lost password page which would be "chat2.cgi?action=send_pwd&name=..." I'm sorry if this is confusing, I'm not sure that I am explaining this right. When the user enters an invalid password, it takes them to the lost password page which contains a link "lost password" and will automatically email them their login details when clicked on. When they click that link, the URL contains the string "chat2.cgi?action=send_pwd&name=username" What I would like to do is put a link on the login page (like most normal chat rooms have) that says "Forgot Password?". When clicked on, I want it to take them to a page where all they have to do is enter their username in a form and click Submit, then have a Javascript code automatically extract their username from that field and insert their username automatically to the end of that URL (chat2.cgi?action=send_pwd&name=...) where ... would be the name extracted from that form field. This would result in the browser taking them to that URL which would trigger the chat to automatically email the password. Can I do this with Javascript?? If so, any help would be greatly appreciated! Hello all out there I am going to post this in 2 separate views. I am working on an assignment from this link http://books.google.ca/books?id=aG_T2aD ... MonthCell()&source=bl&ots=EJXyGF-tbI&sig=vbgqgua2uSaL6DWp0Rx_BYoZ0z8&hl=en&ei=9C7gTLmiAYaXnAeywLWRDw&sa=X&oi=book_result&ct=result&re snum=1&ved=0CBcQ6AEwAA#v=onepage&q=writeMonthCell()&f=false if u scroll down to case 1 is what I am working on included in the case are 2 other files as to the one i have to work on i used all the proper steps and instructions and i think I have the correcting coding for my form however my program still does not work here is the exact code i am using let me know if anyone sees any errors, as I am convinced i have it correct? Here is my code: <html> <head> <!-- New Perspectives on JavaScript Tutorial 3 Case Problem 1 The Lighthouse Author: John Res Date: November 14 2010 Filename: clist.htm Supporting files: lhouse.css, list.js, logo.jpg --> <title>The Lighthouse</title> <link href="lhouse.css" rel="stylesheet" type="text/css" /> <script type"text/javascript" src"list.js"></script> <script type="text/javascript"> function amountTotal() { // return sum of values to amount array total=0; for(var i=0; i<amount.length; i++) { // set variable to 0 total+=amount[i]; } return total; } </script> </head> <body> <div id="title"> <img src="logo.jpg" alt="The Lighthouse" /> The Lighthouse<br /> 543 Oak Street<br /> Delphi, KY 89011<br/> (542) 555-7511 </div> <div id="data_list"> <script type=”text/javascript”> // set up variables of rows and cellspaces document.write(“<table border=’1′ rules=’rows’ cellspacing=’0′>”); document.write(“<tr><th>Date</th><th>Amount</th><th>First Name</th>”); document.write(“<th>Last Name</th><th>Address</th></tr>”); for (i=0; i< amount.length; i++) { // create a loop in counter of variable starting at 0 and increase of 1 increments if (i%2==0) document.write(“<tr>”); else document.write(“<tr class=’yellowrow’>”); // have every row with a yellow background use a loop document.write(“<td>”+date[i]+”</td>”); document.write(“<td class=’amt’>”+amount[i]+”</td>”); // have values of the dates document.write(“<td>”+firstName[i]+”</td>”); document.write(“<td>”+lastName[i]+”</td>”); document.write(“<td>”); document.write(street[i]+”<br />”); document.write(city[i]+”, “+state[i]+” “+zip[i]); // zip arrays for address document.write(“</td>”); document.write(“</tr>”); } document.write(“</table>”); </script> </div> <div id="totals"> <script type=”text/javascript”> // use script elements in HTML document.write(“<table border=’1′ cellspacing=’1′>”); document.write(“<tr><th id=’sumTitle’ colspan=’2′>Summary</th></tr>”); document.write(“<tr><th>Contributors</th>”); document.write(“<td>”+amount.length+”</td></tr>”); document.write(“<tr><th>Amount</th>”); document.write(“<td>$”+amountTotal()+”</td></tr>”); document.write(“</table>”); </script> </div> </body> </html> thanks everyone |