JavaScript - Javascript In Table Messing Up Original Behavior
I'm trying to create a demo to display a new way of showing our data. I thought I remembered this being pretty simple but I'm hitting a snag. The table, the mouse over, and the check row by clicking on the row all work separately but when the check row by clicking function is on, seen in the first row, the checkbox stops working. Any insight into why this may be true? Any help is greatly appreciated
Code: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function selectRow(row) { var firstInput = row.getElementsByTagName('input')[0]; firstInput.checked = !firstInput.checked; } </script> </head> <body> <table id="tbl" border="2"> <thead> <tr> <td></td> <td>First Row</td> <td>Second Row</td> <td>Third Row</td> </tr> </thead> <tbody> <tr onclick="selectRow(this)" onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>1</td> <td>1</td> <td>1</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>2</td> <td>2</td> <td>2</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>3</td> <td>3</td> <td>3</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>4</td> <td>4</td> <td>4</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>5</td> <td>5</td> <td>5</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>6</td> <td>6</td> <td>6</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>7</td> <td>7</td> <td>7</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>8</td> <td>8</td> <td>8</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>9</td> <td>9</td> <td>9</td> </tr> <tr onmouseover="this.style.cursor='hand'"> <td> <input type="checkbox" class = "chcktbl"/> </td> <td>10</td> <td>10</td> <td>10</td> </tr> </tbody> </table> </body> </html> Similar TutorialsAt least, I think it is. On my test site (http://goo.gl/P4SLu), you'll see that the URL first goes to "emineer.com/thesis/," but then quickly changes to "emineer.com/thesis/#page=tabsservices" which refers to a piece of .js I have lower on the page (the tabbed navigation). Is there a way for me to configure this js or CSS so that the URLs are unchanged? I know it's possible because my main site functions perfectly fine: (emineer.com). The code on my main site is just clunky so I decided to start from scratch. Any help here? I'd really like my URLs clean and free of any tags or anything like that. Thanks, Brandon For part of a project, I'm trying to create an order form with a real-time calculator (so, for example, if you enter in a quantity of a product into a form input box, it will multiply that quantity with the price of the product and display the total price in a different form input box). Most of the code works, in the sense that when I press the submit button on the form, I can see all of the values of each of the form input boxes in the address bar. However, when I wrote a function that sums all of the individual total prices into a final price and displays that in another form input box, pressing the submit button no longer puts the value of each field into the address bar. (In effect, everything works if I remove this code...but I really want to include it, since it seems like such a logical part of my intentions with this webpage.) Here's the function that I'm trying to get to work with the form. ("orderform" is the name of the form, and all of the "t#"s are the individual total prices that I'm trying to sum.) I know this code is probably far from the most efficient solution, but as long as it works...ahaha... Code: function totaled(){ b = parseInt(document.orderform["t0"].value); c = parseInt(document.orderform["t1"].value); d = parseInt(document.orderform["t2"].value); e = parseInt(document.orderform["t3"].value); f = parseInt(document.orderform["t4"].value); g = parseInt(document.orderform["t5"].value); h = parseInt(document.orderform["t6"].value); i = parseInt(document.orderform["t7"].value); j = parseInt(document.orderform["t8"].value); a = b+c+d+e+f+g+h+i+j; document.orderform["total"].value = a; } Could anyone help me out, in explaining why my code is messing up the form submission? And I really really apologize if anyone out there is appalled by some ignorance of mine - I'm only just starting to learn how to use JavaScript. (Also, I'm sorry if I referred to things with the wrong terms and confused anyone. I'm not too good with proper naming either.) Oh, right! Just wanted to add, the code does exactly what it's supposed to do (minus the messed up form submission) and nothing comes up in the Error Console when I open my webpage, so there's no help to be found there. (I doubt that was actually helpful, but just in case...) This is the weirdest thing I've come across in awhile. I have some code that formats a input field for a date format. This code runs fine on all browser when the form tag isn't wrapped around the inputs. The second I wrap the form tag around the inputs everything messes up. The Javascript error I'm getting is "Object doesn't support this property or method." on line 45 which is the line of the date input field. I'm totally clueless what I'm doing wrong here. And so I'll leave it up to you the wonderful community to give me some help. Thanks, Jon W Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html leng="en"> <head> <script type="text/javascript"> function dob(val,e) { if(e.keyCode != 8) { if(val.length == 2 || val.length == 5) { if(val.match(/[\/]$/) != "/") { document.getElementById('dob').value += "/"; } } var regex = /[a-zA-Z]|\+|\-|\&|\\|\(|\)|\%\|\$|\#|\@|\*|\_|\?|\>|\<|\,|\./; if(val.match(regex)) { newStr = val.replace(regex,''); document.getElementById('dob').value = newStr; } } } </script> <style type="text/css">@import url(/css/home.css);</style> </head> <body> <div id="wrapper"> <div id="header"> <div id="logo"><a href="/index.php"><img src="/images/logo.png" /></a></div> </div> <div id="container-arrow"></div> <div id="container"> <img src="/images/no_image.png" /> <div id="sign-container"> <span class="sign-header"> Sign Up </span> <div id="sign-arrow-up"></div> <div id="sign-content"> <form method="post" action="/account/index.php" name="sign"> <label for="email">Email</label><input name="email" class="sign-inputs" type="text" /> <p> </p> <label for="password">Password</label><input name="password" class="sign-inputs" type="password" /> <p> </p> <label for="dob">Date Of Birth</label> <input type="text" name="dob" style="text-align:center;" maxlength="10" class="sign-inputs" id="dob" value="MM/DD/YYY" onkeyup="dob(this.value,event);" onkeydown="dob(this.value,event);" onfocus="if(this.value=='MM/DD/YYY') this.value='';" title="MM/DD/YYY" /> <p> </p> <input name="submit" type="submit" class="sign-submit" value="Sign Up" /> </form> </div> </form> </div> </div> </div> </body> </html> OK, a friend and I have been working on implementing the javascript slider you see in the header of my website http://www.billboardfamily.com (hover over the facebook icon under the search area). For some reason, this is causing a lot of the other items on the site to stop functioning all together. Can anyone help me figure out how to fix this? NOTE: Running Wordpress Here are some of the problems: 1) http://billboardfamily.com/videos/ The thumbnail videos do not work when you click them 2) http://billboardfamily.com/the-process/ All 4 slides are on the page, but the slider is not working at all. 3) http://billboardfamily.com/contact-us/ The contact forms I have running are not working correctly, and the styling is no longer correct. Hi guys! I'm having trouble deciphering the javascript on my webpage www.laurahenderson.org is my website, and I'd like the nav bar to be closed when the site loads. Here is the code: Code: jQuery.noConflict(); jQuery(document).ready(function(){ //VAR SETUP var rightBg = jQuery('#rightBg'), boxStuff = jQuery('.boxStuff'), bgControls = jQuery("#bgControls"), nextImg = jQuery('#nextImg'), prevImg = jQuery('#prevImg'), blogNav = jQuery('#blogNav'), navBox = jQuery("#navBox"), navBoxa = jQuery("#navBox a"), navHeight = navBox.height(), firstImg = jQuery('.wrapperli:first-child'), lastImg = jQuery('.wrapperli:last-child'), //iPad,iPhone,iPod... deviceAgent = navigator.userAgent.toLowerCase(), iPhone = deviceAgent.match(/(iphone|ipod)/); //CLOSE FUNCTION function closeSesame(){ jQuery('.activeBox').fadeOut(600,function(){ navBox.animate({right:"0%",marginRight:"20px"},800).removeClass('openNav'); jQuery(".activeNav").removeClass('activeNav'); rightBg.animate({width:"0%"},800);//HIDE RIGHT BG bgControls.fadeIn(600); }).removeClass('activeBox'); } //OPEN FUNCTION function openSesame(){ navBox.addClass("openNav").animate({right:"50%",marginRight:"2px"},800);//ADD OPEN NAV rightBg.animate({width:"50%"},800,function(){//SHOW RIGHT BG jQuery('.activeBox').fadeIn(600);//ADD ACTIVE BOX & FADE IN navBox.fadeIn(600); }); bgControls.fadeOut(300); } //OPACITY STUFF rightBg.css({opacity:".85"}); //REMOVE TITLE ATTRIBUTE jQuery("#dropmenu a").removeAttr("title"); //MENU jQuery("#dropmenu ul").css("display", "none"); // Opera Fix jQuery("#dropmenu li").hover(function(){ jQuery(this).find('ul:first').show(); },function(){ jQuery(this).find('ul:first').hide(); }); jQuery("#dropmenu ul li ul").parent().children("a").prepend("<span style='float:right;'>›</span>"); //PRETTY PHOTO jQuery("a[href$='jpg'],a[href$='png'],a[href$='gif']").not(".wrapperli a").attr({rel: "prettyPhoto"}); jQuery(".gallery-icon > a[href$='jpg'],.gallery-icon > a[href$='png'],.gallery-icon > a[href$='gif']").attr({rel: "prettyPhoto[pp_gal]"}); jQuery("a[rel^='prettyPhoto']").prettyPhoto({ animation_speed: 'normal', // fast/slow/normal opacity: 0.35, // Value betwee 0 and 1 show_title: false, // true/false allow_resize: true, // true/false overlay_gallery: false, counter_separator_label: ' of ', // The separator for the gallery counter 1 "of" 2 //theme: 'light_rounded', // light_rounded / dark_rounded / light_square / dark_square hideflash: true, // Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto modal: false // If set to true, only the close button will close the window }); //WINDOW LOAD jQuery(window).load(function(){ //REMOVE WIDTH AND HEIGHT ATTRIBUTES FROM IMAGES jQuery('.attachment-full, .attachment-post-thumbnail, .attachment-gallery').removeAttr('height').removeAttr('width'); //LOAD MESH BG jQuery('#mesh').fadeIn(600); jQuery('#loading').fadeOut(600); //IF GALLERY PAGE if(jQuery('body').hasClass('page-template-page_gallery-php')){ navBox.fadeIn(600); bgControls.fadeIn(600); jQuery(".wrapperli:first-child a").click(); //IF NOT GALLERY PAGE } else { openSesame(); } }); //FADE CRUMBS IN/OUT ON SCROLL jQuery('#pageContent').scroll(function(){ if(jQuery('#pageContent').scrollTop()>150){ blogNav.fadeOut(300); } else { blogNav.fadeIn(300); } }); //NAV BOX STUFF navBox.css({marginTop:"-"+navHeight/2+"px"}); boxStuff.css({marginTop:"-"+navHeight/2+"px"}); //NAV BUTTON CLICK navBoxa.click(function(){ //VAR SETUP var thisBox = jQuery(this).attr('href'); //IF ACTIVE LINK, CLOSE STUFF if(jQuery(this).hasClass('activeNav')){ closeSesame(); return false; //IF NOT ACTIVE LINK }else{ //IF CONTENT OPEN if(navBox.hasClass("openNav")){ navBoxa.removeClass('activeNav');//REMOVE CURRENT ACTIVE NAV jQuery(this).addClass('activeNav');//ADD NEW ACTIVE NAV jQuery('.activeBox').removeClass('activeBox').fadeOut(300,function(){//REMOVE CURRENT ACTIVE BOX & FADE OUT jQuery(thisBox).addClass('activeBox').fadeIn(300);//ADD NEW ACTIVE BOX & FADE IN }); //IF CONTENT NOT OPEN } else { jQuery(this).addClass('activeNav');//ADD ACTIVE NAV jQuery(thisBox).addClass('activeBox'); openSesame(); } } }); //CLICKING GALLERY IMG jQuery(".wrapperli a").click(function(){ if(iPhone){ return false; }else{ //GET HREF var galleryHref = jQuery(this).attr('href'), galleryTitle = jQuery(this).attr('title'), imageInfo = jQuery('#imgInfo'), itemNumber = jQuery(this).parent().index() + 1; numberItems = jQuery('.wrapperli').length; //CHANGE TITLE INFO if(galleryTitle){ imageInfo.hide().html(galleryTitle + "  /  "+ itemNumber + " of " + numberItems).fadeIn(150); } else { imageInfo.hide(); } //CHANGE CLASSES jQuery(".wrapperli").not(this).removeClass('activeImg'); jQuery(this).parent().addClass('activeImg'); //IF MENU OPEN, CLOSE IT if(navBox.hasClass("openNav")){ closeSesame(); } //CHANGE BACKGROUND jQuery.backstretch(galleryHref, {speed: 300}); return false; } }); //NEXT CONTROLS nextImg.click(function(){ var activeImg = jQuery('.activeImg'); if(activeImg.length > 0){ if(activeImg.next().length > 0){ activeImg.removeClass('activeImg').next().addClass('activeImg').children().click(); } else { activeImg.removeClass('activeImg'); firstImg.addClass('activeImg').children().click(); } } else { firstImg.addClass('activeImg').children().click(); } return false; }); //PREV CONTROLS prevImg.click(function(){ var activeImg = jQuery('.activeImg'); if(activeImg.length > 0){ if(activeImg.prev().length > 0){ activeImg.removeClass('activeImg').prev().addClass('activeImg').children().click(); } else { activeImg.removeClass('activeImg'); lastImg.addClass('activeImg').children().click(); } } else { firstImg.addClass('activeImg').children().click(); } return false; }); // Keyboard shortcuts jQuery(document).keydown(function(e) { var unicode = e.charCode ? e.charCode : e.keyCode; if (unicode == 39) { nextImg.click();} // right arrow else if (unicode == 37) {prevImg.click();} // left arrow }); }); and I changed the open sesame to closed sesame here in the code Code: //IF CONTENT NOT OPEN } else { jQuery(this).addClass('activeNav');//ADD ACTIVE NAV jQuery(thisBox).addClass('activeBox'); openSesame(); } } }); but now when the page loads the navbar wont show up at all. Any help/insight would be much appreciated! Sorry if this is the wrong forum for this question. I get confused about what forum to post a question in with regards to DHTML technologies since they are all frequently used together. Anyhoo, heres my question. I've recently discovered an interesting behavior. When I mouse over a nested element it triggers the 'onmouseout' event handler of the parent element. Take the following code snippet, for instance: Code: <table> <tr> <td onmouseout="window.alert('you moused out of td');"> <img src="image0.gif" style="height:50px; width:50px;" /> </td> </tr> </table> In the code snippet above, the 'onmouseout' event handler executes when you mouse over the image nested inside the <td> element. I wouldn't have thought this would be the appropriate behavior since from my perspective the mouse is still inside the <td> element. Can someone make comments on this. Thank You. Edit: I've discovered that mousing over a nested element causes both an 'onmouseout' and an 'onmouseover' event for the parent element. They are called back to back. Seems a little bit of an odd sequence of events but maybe it makes sense in the grand scheme of things. Yeah, right. Hi! I couldn't find any information about this topic in the internet and I really wonder, how come people do not discuss it anywhere? Okay, jQuery works really great and offers many interesting effects, but what if you have JavaScript disabled? I mean I've browsed through several websites powered by jQuery with JS disabled and they doesn't work or behave weird. I know there aren't much people, who disable JS, but well I do want my page to be seen by all people in the end. I managed to do it with slider on my page (however I want to use other jQuery effects), but, for example, http://www.flowplaye...ools/index.html doesn't provide any information about this. Try to disable JS and see that nothing works. I can use <noscript></noscript> tag, but I have to make two main pages. And what if I want to view it on one page? What would you do? Regards, Aleks. Hi, I'm using javascript in addition to a web service (BTBuckets) to display different content to visitors based on actions they take on my site. The javascript is working fine, but I noticed that if I simulate BTBuckets being disabled using Firefox Adblock none of the content shows up. So in the off chance of the service going offline it'll leave some pretty funky holes in the my content. I tried <noscript> tags which works with javascript off, but the content is still blank when I disable BTBuckets. I'm wondering if there's a way to display the default content if the service is unavailable? Here's the code I'm using: In the head: Code: <script type="text/javascript"> //<![CDATA[[ $BTB={s:XXXXX}; $BTB.jsh="http://static.btbuckets.com/bt.js"; //]]> </script> <script type="text/javascript"> document.write(unescape("%3Cscript src='" + $BTB.jsh.replace(/(https?:)/i,document.location.protocol) + "' type='text/javascript'%3E%3C/script%3E")); </script> The code in the body used to replace an image depending on visitor behavior: Code: <script type="text/javascript"> var _t = ""; if ($BTB.clusters["ppc_visitors"]) { _t = "\"images/top-photo-tracking-number.jpg\" alt=\"Call Toll-Free: 1-800-XXX-XXXX\">"; } else { _t = "\"images/top-photo.jpg\" alt=\"Call Toll-Free: 1-800-XXX-XXXX\">"; } document.write('<img src= ' + _t ); </script> <noscript><img src="images/top-photo.jpg" alt="Call Toll-Free: 1-800-XXX-XXXX"></noscript> Hi, Because I'm using an asp script to submit this form, I cannot do a validation on the submit and so have chosen to do the validation with the onblur and the onmouseout functions. The validation works well for the checking the first input, id CommenterName. If it's blank, the alert displays and then the cursor is moved to the email check. When the alert is dismissed the focus returns to the first input, but, and this is the problem, returning to the first input, triggers the second alert. How do I return the focus to the first field without triggering the next alert? Changing the order of the inputs in not an option. Code: function checkCompletitionName(){ if (document.getElementById("CommenterName").value.length == 0) { document.getElementById("CommenterName").style.backgroundColor = "#efefef"; alert("Please type your name."); document.getElementById("CommenterName").focus(); return; } else { document.getElementById("CommenterName").style.backgroundColor = "white"; } } function checkCompletitionEmail(){ if (document.getElementById("Email").value.length == 0 || (document.getElementById("Email").value.search("@") == -1 || document.getElementById("Email").value.search("[.*]") == -1)) { document.getElementById("Email").style.backgroundColor = "#efefef"; alert("Please check the email address for errors."); return; } else { document.getElementById("Email").style.backgroundColor = "white"; } } function checkCompletitionComment(){ if (document.getElementById("Comment").value.length == 0) { document.getElementById("Comment").style.backgroundColor = "#efefef"; alert("Please type your comment."); return; document.getElementById("Comment").focus(); } else { document.getElementById("Comment").style.backgroundColor = "white"; } } the HTML code: Code: <form name="form1" method="get" action="/asp/formmail.asp"> <p> <label class="labelContact">Select Category:</label> <select class="inputContact" name="category" id="category"> <option selected="selected" value="support" id="support">Support</option> <option value="sales" id="sales">Sales</option> <option value="other" id="other">Other</option> </select> </p> <p> <label class="labelContact" for="CommenterName">Name <span class="redasterisk">*</span>:</label> <input size="42" class="inputContact" name="nameCommenter" id="CommenterName" onblur="checkCompletitionName()" type="text" /> </p> <p> <label class="labelContact" for="Email">Email Address<span class="redasterisk"> *</span>:</label> <input size="42" class="inputContact" name="email_address" id="Email" onblur="checkCompletitionEmail()" type="text" /> </p> <p> <label class="labelContact" for="Phone">Phone Number:</label> <input id="phoneAreaCode" class="inputContact" onKeyUp="return autoTab(this, 3, event);" size="4" maxlength="3" /> - <input id="phonePrefix" onKeyUp="return autoTab(this, 3, event);" size="4" maxlength="3" /> - <input id="phoneLastFour" onKeyUp="return autoTab(this, 4, event);" size="5" maxlength="4" /> </p> <p> <label class="labelContact" for="RegistrationNo">Registration Number:</label> <input size="42" class="inputContact" name="registration" id="RegistrationNo" type="text" /> </p> <p> <label class="labelContact" for="CompanyName">Company Name:</label> <input size="42" class="inputContact" name="company_name" id="CompanyName" type="text" /> </p> <p>Comments <span class="redasterisk">*</span>:</p> <p><textarea rows="5" cols="58" name="comment" id="Comment" onmouseout="checkCompletitionComment()"></textarea></p> thank you for your help Needless to say, I am no coder! I dabble with it only when I have to. I have images/text linked to buttons that fade in “onclick” from “original” images/text . I’ve gotten this to work great with text or image but… I would like the images/text to fade out and return to “original” images/text after a time limit and or no mouse use. Here’s the code I have so far: Code: $(document).ready(function(){ $('.image1).click(function() { $('#original_image).fadeOut(300, function() { var the_image = $('#image1).html(); $(this).html(the_image).fadeIn(300); }); }); Thanks My issue is that I have a javascript function applied on page load via an addLoadEvent function call in the head to every row (dynamic number of records retrieved) on a table. On every row of the table I also have an element (image or button) that performs a different function that is assigned on the element itself. Unfortunately, when I click the element it also performs the function that was applied to the row in the page load. Is there any way to not call this function on element click? I know usually you include code, but due to the nature of the work I am limited in that respect. Basically its: Code: <script type="text/javascript"> addLoadEvent(function() { function1(1); }) //function1 makes the table rows do something appearance wise. </script> <tr> <td></td> <td></td> <td> <img src="pics/delete.png" alt="Delete" onclick="function2();"> </td> </tr> I apologize if my post doesn't conform to the general guidelines of proper posting on this board. I'm new on this site. A while back, Old Pedant wrote a nifty function which changes the class of different sets of <p> elements, in order to change the content and style of their css ':afters'. You can see it in action here: welcome > consult > ready ? > make line one > etc: the ':afters' are the small red markers which appear in the middle of the red lines. I'm now writing functions for "back" links which will return the page to its original state. I've managed to do this for most elements (change display, colour, etc): however, these ':afters' are proving a problem. The css for the original ':afters' Code: .hex p:after { position:relative; top:0.74em; left:-2.10em; z-index:-1; font-size:0.50em; content:":"; visibility:hidden; } The logic of applying elaborate css, and then hiding the result is this: the css alters the line-height of the p element, so a dummy version is to applied at the outset, before the specific versions are activated. The css for the changed ':afters' Code: p.xV1:after, p.xV2:after, p.xV3:after, p.xV4:after, p.xV5:after, p.xV6:after { color:#f03; visibility:visible; content:"x"; } p.oV1:after, p.oV2:after, p.oV3:after, p.oV4:after, p.oV5:after, p.oV6:after { color:#f03; visibility:visible; content:"O"; } What needs to happen is for all of these p classes to be returned to the css '.hex p:after' . I think the function might look something like Code: function returnAfters(){ for (i=0; i<elP.length; i++) { if (elP.item(i).className.charAt(1) == "V") { elP.item(i).className = "hex p";} } The original function, altho I don't think it's needed to solve this, can be found here, at line 295. Meanwhile, one other problem area involves a jQuery function, so I'll post elsewhere. Cheers! I am trying to write a custom BBcode for a forum I moderate. I don't have the licensing information because its not my forum and i am just a moderator. If anyone wants to verify the legitimacy of the forum I work for please PM me and I will try and get you any information I can. This code that I has works perfect in EditRocket, but when I add it to the custom BBcode the image does not resize. Original EditBucket Code: Code: <html> <head> <script type="text/javascript"> function show_confirm(testimg) { var theImg = document.getElementById('testimg'); var theWidth = theImg.width; var theHeight = theImg.height; if (theWidth<250) { theImg.width = theWidth; theImg.height = theHeight; } else { theImg.width = 250; theImg.height = theHeight*(250/theWidth); } } </script> </head> <body> <img id="testimg" onload="show_confirm(testimg)" src="http://upload.wikimedia.org/wikipedia/commons/thumb/8/84/Example.svg/600px-Example.svg.png"> </body> </html> vBulletin Custom BBcode: title: Test Image bbcode tag name: timage Replacement: Code: <script type="text/javascript"> function show_confirm(testimg) { var theImg = document.getElementById('testimg'); var theWidth = theImg.width; var theHeight = theImg.height; if (theWidth<250) { theImg.width = theWidth; theImg.height = theHeight; } else { theImg.width = 250; theImg.height = theHeight*(250/theWidth); } } </script> <body> <img id="testimg" onload="show_confirm(testimg)" src="{param}"> </body> Example: [timage]http://upload.wikimedia.org/wikipedia/commons/thumb/8/84/Example.svg/600px-Example.svg.png[/timage] Description: Embed imaged inline with forum Option: no Code: <script type="text/javascript"> function countItDown(){ var current=parseFloat(document.getElementById("currentsecondscount").value); var seconds=current; document.getElementById("debug").innerHTML="S "+current; var minutes=Math.floor(seconds/60); document.getElementById("debug").innerHTML+="<br>M "+minutes; var hours=Math.floor(minutes/60); document.getElementById("debug").innerHTML+="<br>H "+hours; var days=Math.floor(hours/24); document.getElementById("debug").innerHTML+="<br>D "+days; var remainingseconds=seconds-(minutes*60); document.getElementById("debug").innerHTML+="<br>RS "+remainingseconds; var remainingminutes=minutes-(hours*60); document.getElementById("debug").innerHTML+="<br>RM "+remainingminutes; var remaininghours=hours-(days*24); document.getElementById("debug").innerHTML+="<br>RH "+remaininghours; if(days<10){ days="0"+days; } if(remaininghours<10){ remaininghours="0"+remaininghours;} if(remainingminutes<10){ remainingminutes="0"+remainingminutes;} if(remainingseconds<10){ remainingseconds="0"+remainingseconds;} document.getElementById("days").innerHTML=days; document.getElementById("hours").innerHTML=remaininghours; document.getElementById("minutes").innerHTML=remainingminutes; document.getElementById("seconds").innerHTML=remainingseconds; document.getElementById("currentsecondscount").value=(current-1); } </script> ....... <input type="hidden" id="currentsecondscount" value="<?=$seconds;?>" /> ....... Chrome/IE/etc on Left... FF 3.6.3 [windows] on Right im not sure why Firefox is doing this. it seems to work fine on Firefox 3.6.3 for Mac... I have been testing regex test string to match the following pattern (- <any number with/without . decimal point>) ( -[#[.#]] ) here is the code that works the best: Code: var testStr = '99999+((-25.533) - 5)/99*(-25.533)'; var negValTestStr = new RegExp('\\(\-{1}[0-9]*\.?[0-9]*\\)', 'g'); var test = testStr.match(negValTestStr) alert(test); The question is: Why does it only work when the open and close parenthesis are double escaped: '\\(' and '\\)' When I use one backslash to escape, it will find -25.533, -5 and -25.533 With two backslashes for escape sequence: (-25.533), (-25.533) Also, I have to escape the - to get just one -. If I do not escape the -, -?; which should read - {0, 1} will match --# without escaping - Thanks for thoughts on this JK Hi, I am trying to figure out how the get the featured area at http://blueoceanportfolios.com to link to webpages rather than displaying it within the featured box on the left . This area is using JS file to display the videos on content in the featured box when different items on the menu are clicked, here is the working example : http://www.blueoceanportfolios.com/company/ Okay , The problem: Loading a new webpage rather than displaying the content at featured box at http://blueoceanportfolios.com Tried solutions: linking to javascript functions like onclick="window.location="http://someplace.com";" etc but still the content loads up in the featured box , try clicking on 2) it displays http://www.codingforums.com rather than loading new page. Any suggestions Hi everyone Im new here nice forum Hope someone can help out with my problem http://www.testingremote.ucoz.com/ When you click on anything other than home on the nav bar it messes up the appear/fade behavior that I added with dreamweaver any solutions ? Please help ! I have an interval set that runs indefinitely (backgrounds switching) or until the viewer stops it. I've noticed that when I close a tab while it's running and revisit the page, it "doubles" the interval and the backgrounds get mixed up. Refreshing the page returns it to normal. Does anyone know how to fix this? I've tried clearing the interval with window.onunload and window.onbeforeunload. I'm thinking it has something to do with firefox not clearing its cache for the tab. I'll look into disabling that. Since it is not clear to me where this post should fit in the forum, I'm just posting it here. Is it possible to create a tracking code that would allow me to: (1) a) Find out the identity of visitors to a certain website (a website unrelated to me and the visitors did not visit my website) b) The identity of those who recently searched for a certain keywords and/or... (2) Find out what websites certain individuals have recently visited (or visiting in real-time)? Ok, so I wanted to use the following object to copy the contents of the Report array at index [file][entry]. Code: Selected = { fileIndex : file, entryIndex : entry, Entry : Report[file][entry] } This was done so that the user may perform modifications to the entry without updating the entry until I have run validation on the input. Then I used Code: if(valid) Report[Selected.fileIndex][Selected.entryIndex] = Selected.Entry to finish up. I noticed that the Report array was getting the new input even when I didn't validate. I used the following to view all the contents of the Report Array in real time Code: window.setInterval('SHOW_ARRAY();',200); Report=[]; function SHOW_ARRAY(){ HTML('ReportDebug','') //Reset "ReportDebug" HTML element for(var t in Report){ for(var y in Report[t]){ for(var u in Report[t][y]){ HTML('ReportDebug','<span style="position:relative ; border:2px solid black">'+Report[t][y][u]+'</span>',1) // last argument signifies to append HTML element } } HTML('ReportDebug','<br />',1) } } And what I discovered was that whenever I stored values in Selected.Entry the Report array would update with those values! This is my first attempt to create an object in this fashion, so my only guess is that Selected.Entry is not independent from Report[file][entry], but instead some kind of pointer... Where have I gone wrong, and how can I accomplish my goal? Let me know if my code samples were too brief. |