JavaScript - Javascript That's Breaking Css?
Hope I'm posting in the right section.
At first I thought this was a CSS problem, but after careful exclusion of certain code in the CSS script, it looks to be a java issue...maybe. Here's the main page of the website I'm developing. Everything is running fine on he http://rutholsonphoto.com/test_build/index.php However this next page seems to be breaking my footer (the copyright and affiliation information). I have no idea how or why this is happening, but I'm hoping someone can go through my code and see what's up. http://rutholsonphoto.com/test_build/votenow-1.php Here's the included php script for the second page that SEEMS to be the culprit: Code: <script type="text/javascript"> /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") //////////////////////////////////// </script> <div id="maincontent"> <div id="titlebar"> <center><h3>2011 Senior Challenge Contestants</h3> </center> </div> <br /> <div id="subtitlebar"> <center> <strong>Senior Challenge Top 20:</strong> <a href="/voteresults.php">Click Here to View the Top 20!</a><br /> <br /> <div style="font-size:14px;">To build suspense we have removed the voting counters. Keep up the voting!</div> <div style="font-size:12px;">Only One Vote Per Household.</div><br /> </center> </div> <body class="section-1"> <ul id="menu"> <li><a href="./votenow-1.php"><u>A - F</u></a></li> <li><a href="./votenow-2.php"><u>G - L</u></a></li> <li><a href="./votenow-6.php"><u>M - R</u></a></li> <li><a href="./votenow-4.php"><u>S - X</u></a></li> <li><a href="./votenow-5.php"><u>Y - Z</u></a></li> </ul> </body> <div style="background-color:#d0d0d0" id="overlay"> <?php //FOR LETTER: A include("../templates/mysql_connect.php"); $query = "SELECT * FROM seniors WHERE last_name LIKE 'A%' ORDER BY last_name ASC"; $result = @mysql_query ($query); echo '<table width="480" height="150"><tr> <td width="161" valign="top" align="center"> <p><span class="style19"><u>-A-</u></span><br />'; while ($row = mysql_fetch_array ($result)){ echo "<a href=\"$row[pic_url]\" rel=\"lightbox[seniors]\" title=\" <form action ="/tallyvote.php?sen_id=$row[sen_id]" method="post"> $row[first_name] $row[last_name] - $row[school] <br /> <input name="submit" align="right" type="submit" value="Vote" > </form> \">$row[last_name], $row[first_name]</a><br/>"; } echo '</p>'; ?> <?php //FOR LETTER: B $query = "SELECT * FROM seniors WHERE last_name LIKE 'B%' ORDER BY last_name ASC"; $result = @mysql_query ($query); echo '<td width="161" valign="top" align="center"><p><span class="style19"><u>-B-</u></span><br />'; while ($row = mysql_fetch_array ($result)){ echo "<a href=\"$row[pic_url]\" rel=\"lightbox[seniors]\" title=\" <form action ="/tallyvote.php?sen_id=$row[sen_id]" method="post"> $row[first_name] $row[last_name] - $row[school] <input name="submit" type="submit" value="Vote" > </form> \">$row[last_name], $row[first_name]</a><br/>"; } echo '</p></td>'; ?> <?php //FOR LETTER: C $query = "SELECT * FROM seniors WHERE last_name LIKE 'C%' ORDER BY last_name ASC"; $result = @mysql_query ($query); echo '<td width="161" valign="top" align="center"><p><span class="style19"><u>-C-</u></span><br />'; while ($row = mysql_fetch_array ($result)){ echo "<a href=\"$row[pic_url]\" rel=\"lightbox[seniors]\" title=\" <form action ="/tallyvote.php?sen_id=$row[sen_id]" method="post"> $row[first_name] $row[last_name] - $row[school] <input name="submit" type="submit" value="Vote" > </form> \">$row[last_name], $row[first_name]</a><br/>"; } echo '</p></td></tr>'; ?> <?php //FOR LETTER: D $query = "SELECT * FROM seniors WHERE last_name LIKE 'D%' ORDER BY last_name ASC"; $result = @mysql_query ($query); echo '<tr><td width="161" valign="top" align="center"><p><span class="style19"><u>-D-</u></span><br />'; while ($row = mysql_fetch_array ($result)){ echo "<a href=\"$row[pic_url]\" rel=\"lightbox[seniors]\" title=\" <form action ="/tallyvote.php?sen_id=$row[sen_id]" method="post"> $row[first_name] $row[last_name] - $row[school] <input name="submit" type="submit" value="Vote" > </form> \">$row[last_name], $row[first_name]</a><br/>"; } echo '</p></td>'; ?> <?php //FOR LETTER: E $query = "SELECT * FROM seniors WHERE last_name LIKE 'E%' ORDER BY last_name ASC"; $result = @mysql_query ($query); echo '<td width="161" valign="top" align="center"><p><span class="style19"><u>-E-</u></span><br />'; while ($row = mysql_fetch_array ($result)){ echo "<a href=\"$row[pic_url]\" rel=\"lightbox[seniors]\" title=\" <form action ="/tallyvote.php?sen_id=$row[sen_id]" method="post"> $row[first_name] $row[last_name] - $row[school] <input name="submit" type="submit" value="Vote" > </form> \">$row[last_name], $row[first_name]</a><br/>"; } echo '</p></td>'; ?> <?php //FOR LETTER: F $query = "SELECT * FROM seniors WHERE last_name LIKE 'F%' ORDER BY last_name ASC"; $result = @mysql_query ($query); echo '<td width="161" valign="top" align="center"><p><span class="style19"><u>-F-</u></span><br />'; while ($row = mysql_fetch_array ($result)){ echo "<a href=\"$row[pic_url]\" rel=\"lightbox[seniors]\" title=\" <form action ="/tallyvote.php?sen_id=$row[sen_id]" method="post"> $row[first_name] $row[last_name] - $row[school] <input name="submit" type="submit" value="Vote" > </form> \">$row[last_name], $row[first_name]</a><br/>"; } echo '</p></td></tr>'; ?> </div> </div> Please Help. I so wanna get this part over with as it's killing me. Similar TutorialsI'm currently using the following code so that when I hover over my navigation images it fades them when hovered over. Code: <script type="text/javascript">$(function() {$(".fade-in").css("opacity","0");$(".fade-in").hover(function () {$(this).stop().animate({opacity: 1.0}, "220");},function () {$(this).stop().animate({opacity: 0}, "2000");});});</script> It works fine but when I have any other javascripts, such as a lightbox or image swapper, only one of them works. I want a lightbox script on the page so I need to figure out how to get both scripts working together. Note I'm not java developer, I just copied and pasted the code for my website so it's entirely possible, and probable, that I'm making a fundamental error here. It seems to be based on exactly where I add the jquery code. For example if I use the following code then the lightbox works but not the fader. Code: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" src="design/lightbox/prototype.js"></script> <script type="text/javascript" src="design/lightbox/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="design/lightbox/lightbox.js"></script> <script type='text/javascript'>$(function() {$(".fade-in").css("opacity","0");$(".fade-in").hover(function () {$(this).stop().animate({opacity: 1.0}, "220");},function () {$(this).stop().animate({opacity: 0}, "2000");});});</script> But if I use the following code then the lightbox doesn't work but the fader does. Code: <script type="text/javascript" src="design/lightbox/prototype.js"></script> <script type="text/javascript" src="design/lightbox/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="design/lightbox/lightbox.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script> <script type='text/javascript'>$(function() {$(".fade-in").css("opacity","0");$(".fade-in").hover(function () {$(this).stop().animate({opacity: 1.0}, "220");},function () {$(this).stop().animate({opacity: 0}, "2000");});});</script> Anybody know what's happening here? Hello! I come to you guys with a javascript problem. I'm using the javascript mouseover called wz_tooltip.js located here. Inside of it, I'm using many variables which have worked perfectly fine. If any variable has a value that conflicts with javascript, I simply do a php str_replace. This has worked perfectly for all but one issue. When one of the $string has a breaking line in it <br />, it breaks the javascript mouseover entirely. I can't figure this out for the life of me. The mouseover code itself is bolded: Code: $placeholders = array("'", "<br />"); $fixup = array("\'", "TEST"); $saPreview2 = str_replace($placeholders, $fixup, $lastxdevel2['pagetext']); $lastxdevelt2.="<div class='smallfont'><font size='2'><a onmouseover=\"Tip('<b>Title:</b> $saTitle2<br/><b>User:</b> $lastxdevel2[lastposter]<br /><b>Last Post:</b>$agdate2<br/><b>Preview: </b>$saPreview2')\" onmouseout=\"UnTip()\" href='showthread.php?t=$lastxdevel2[threadid]'>$lastxdevel2[title]</a></font></div>"; I tested with other values to make sure that the strings were properly being replaced, and indeed they were. I have the mouseover tooltip set to a specific width. So multiple lines work fine (one line running into another), but if there is a <br /> inside or any form of a formal line break, it literally causes the javascript mouseover script to cease to function. This is impossible to avoid because $string's value is text from a forum post. I'll reiterate that the str replace is working. When I view source, there are no <br/> tags. There are still line breaks though. Why would line breaks in $string cause a javascript mouseover to cease functioning? I have a feeling it must be how the tooltip handles line breaks? Thank you in advance. I have a strange problem. I'm running a shortcut with target: Code: "%PROGRAMFILES%\Internet Explorer\iexplore.exe" -k "C:\myfile.html" It opens the page in kiosk mode. The contents of myfile.html contains an image with an onclick to this function: Code: function loader(){ window.open('myurl.com','',''); } In Windows 7 32-bit running IE8 the url breaks out of kiosk mode. In Windows XP 64-bit running IE7 the url stays in kiosk mode. I can't think why. Is it the IE difference, the bit difference or the platform difference? Anyone struck this before? I know kiosk mode isn't that well used. I am in desperate need for help as I'm pulling my hair out! I'm pretty sure this is JavaScript related. I'm incorporating a WordPress header into Opencart. Its pretty basic. I copied the WordPress header source code into the header of the Opencart and all is well in Firefox & Chrome and Safari. In IE however...If you enter the product page through the categories on the left the product page left aligns and breaks...I can't figure this out for the life of me. I tried to debug it with explorers tools but I don't know enough about Java script to understand why its breaking. Can anyone PLEASE help me on this?!!! My site is http://www.sterlingportable.com/store/ Hi there, i really could use the help. Ok, so (and im sure i will be told other ways) i have come up with a way of blocking people from my site even if they are currently on the site and dont reload the page. What i was thinking of is simply: a tiny iframe on the bottom of my page, so small it cant be seen ie 1px that iframe goes to a page saying YOU HAVE BEEN BANNED That page istself will be on a constant 10 seccond refresh so as soon as i add the ip address to it, BOOM, it will break out of the iframe and take the user away from the main page as display the you have been banned message. Sound good? ok, so here is what i have sofar but i know its wrong, dont really know how to write it correctly. The main point is: if ip is 111.111.111 then break out of iframe else do nothing. Thanks for the help. Code: <script language="JavaScript"> VIH_ForeColor = "navy"; VIH_FontPix = "16"; VIH_DisplayFormat = "%%IP%%"; VIH_DisplayOnPage = "no"; </script> <script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script> <script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script> <script> if (VIH_HostIP == "111.111.111.111") document.write('if (top.location!= self.location) { top.location = self.location.href }' ); }else{ document.write(''); ;} </script> Hi there, i really could use the help. Ok, so (and im sure i will be told other ways) i have come up with a way of blocking people from my site even if they are currently on the site and dont reload the page. What i was thinking of is simply: a tiny iframe on the bottom of my page, so small it cant be seen ie 1px that iframe goes to a page saying YOU HAVE BEEN BANNED That page istself will be on a constant 10 seccond refresh so as soon as i add the ip address to it, BOOM, it will break out of the iframe and take the user away from the main page as display the you have been banned message. Sound good? ok, so here is what i have sofar but i know its wrong, dont really know how to write it correctly. The main point is: if ip is 111.111.111 then break out of iframe else do nothing. Thanks for the help. Code: <script language="JavaScript"> VIH_ForeColor = "navy"; VIH_FontPix = "16"; VIH_DisplayFormat = "%%IP%%"; VIH_DisplayOnPage = "no"; </script> <script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script> <script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script> <script> if (VIH_HostIP == "111.111.111.111") document.write('if (top.location!= self.location) { top.location = self.location.href }' ); }else{ document.write(''); ;} </script> I'm having a problem with links once I insert some javascript for a photo gallery into my page. I'm kind of new to all of this so sorry if this is something really easy, but I would like to make it so doesn't make my navigation links stop working, if possible. Code: $(function() { $(".image").click(function() { var image = $(this).attr("rel"); $('#image').hide(); $('#image').fadeIn('fast'); $('#image').html('<img src="' + image + '"/>'); return false; }); }); Ok, I'm nearly pulling my hair out with this one. I have been looking at this code for two evenings now, and rewrote it 4 times already. It started out as jQuery code and now it's just concatenating strings together. What I'm trying to do: Build a menu/outline using unordered lists from a multidimensional array. What is happening: Inside the buildMenuHTML function, if I call buildMenuHTML, the for loop only happens once (i.e. only for 'i' having a value of '0'.) If I comment out the call to itself, it goes through the for loop all 3 times, but obviously the submenus are not created. Here is the test object: Code: test = [ { "name" : "Menu 1", "url" : "menu1.html", "submenu" : [ { "name" : "menu 1 subitem 1", "url" : "menu1subitem1.html" }, { "name" : "menu 1 subitem 2", "url" : "menu1subitem2.html" } ] }, { "name" : "Menu 2", "url" : "menu2.html", "submenu" : [ { "name" : "menu 2subitem 1", "url" : "menu2subitem1.html" }, { "name" : "menu 2subitem 1", "url" : "menu2subitem1.html" } ] }, { "name" : "Menu 3", "url" : "menu3.html", "submenu" : [ { "name" : "menu 3 subitem 1", "url" : "menu3subitem1.html" }, { "name" : "menu 3 subitem 1", "url" : "menu3subitem1.html" } ] } ]; Here is the recursive function: Code: function buildMenuHTML(menuData,level) { var ul; if (level == 1) { ul = "<ul id='menu'>"; } else { ul = "<ul class='level" + level + "'>"; } for (i = 0; i < menuData.length; i++) { menuItemData = menuData[i]; ul += "<li>"; ul += "<a href='" + menuItemData.url + "'>" + menuItemData.name + "</a>"; if (typeof menuItemData.submenu != 'undefined') { ul += buildMenuHTML(menuItemData.submenu,level + 1); } ul += "</li>"; } ul += "</ul>"; return ul; } Here is how the function is called initially: Code: buildMenuHTML(test,1); This is it's return value (with indentation added for readability): Code: <ul id='menu'> <li><a href='menu1.html'>Menu 1</a> <ul class='level2'> <li><a href='menu1subitem1.html'>menu 1 subitem 1</a></li> <li><a href='menu1subitem2.html'>menu 1 subitem 2</a></li> </ul> </li> </ul> 'Menu 2' and 'Menu 3' don't show up! I'm sure it's something small that I'm overlooking, but any help would be appreciated. Hello! I am trying to find a script that allows you to open multiple browser tabs and then close each of those tabs, either one by one or all at once. Does anyone know how to do this please? Thanks so much for your help. I want to have another go at Javascript. I have several books on the subject but I find that my eyesight is a major problem. Therefore I want to try an on-line solution, preferably free. I have Googled, but there are so many that I am almost dizzy with the choices. Perhaps someone could recommend one. Not too fussy visually. My knowledge is VERY basic. Frank Does anyone know how to make URL links that use Javascript still work when users have Javascript disabled on their browser? The only reason I'm using JS on a URL is because my link opens a PDF file, and I'm forcing it not to cache so users have the latest version. I tried the <script><noscript> tags, but I'm not sure if I'm using it correctly, as my URL completely disappears. Below is my HTML/Javascript code: <p class="download"> <script type="text/javascript">document.write("<span style=\"text-decoration: underline;\"><a href=\"javascript:void(0);\" onclick=\"window.open( 'http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf?nocache='+ Math.floor( Math.random()*11 ) );\" >The Child Magazines Media Kit</a></span> (PDF 1 MB) ");</script> <noscript><span style="text-decoration: underline;"><a href="http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf" >The Child Magazines Media Kit</a></span> (PDF 1 MB)</noscript> </p> Thanks for any help, Michael Hi, I have the following code snippet: test.html ====== <script language="javascript" type="text/javascript"> var testVariable = "test"; </script> <script language="javascript" type="text/javascript" src="test.js"> </script> test.js ===== var testVariable = window.top.testVariable; In firefox, I'm able to access testvariable defined within test.html in test.js. But in chrome, test.js couldnot get the window.top.testVariable field defined in test.html. Can any one please let me know how i can make it work in chrome?. Am i missing something here?. Hi Guys, I am new at JavaScript and start to do some tutorials.What I am trying to do here is prompting user to input a name and if the name was valid the page(document) will display with all objects like the button.But if user enter a wrong name then the button will be disabled! I create the following code but it did not work <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript" type=""> function changeColor(){ document.bgColor = "Gray"; } </script> </head> <body> <script language="JavaScript" type="text/javascript"> var person = ""; person = prompt('What is Your Name:'); if (person == "Foo") { document.write("<h1 />Welcome " + person); document.bgColor = "Yellow"; } else { document.write("<h1 />Access Denied!!!!"); document.bgColor = "Red"; document.getElementById("gree").disabled = true; } </script> <div> <p/><input id="gree" type="button" value="Gray " onClick="changeColor();"> </div> </body> </html> as you can see I used the: document.getElementById("gree").disabled = true; but it did not work , could you please give an idea how I can solve this problem? Thanks I got an index.php Code: <html> <form action="bacakomik.php" method='post'> <select name="kodekomik"> <option value='../komik1/|23'>Judul Komik1</option> <option value="../komik2/|20">Judul Komik2</option> <option value="../komik3/|10">Juduk Komik3</option> <option value="../komik4/|20">Judul Komik4</option> </select> <input type="submit" /> </form> <?php echo ('<select>'); echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); echo ('</select>'); ?> </html> As you can see, each of the option brings specific value "../komik1/|23" komik1 is a directory | is a delimiter 23 is the pages in one chapter and can be considered also as how many images are there on a specific directory This is my bacakomik.php Code: <?php $dirkomik = $_POST['kodekomik']; $exploded = explode("|", $dirkomik); echo ($exploded[0]); //picture directory echo ("<br>"); echo ($exploded[1]); //total page in the comic $pagecount = (int)$exploded[1]; //Take last posted value, process it right away echo ('<FORM name="guideform"> '); echo ('<select name="guidelinks">'); $i=1; do { echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); $i= $i+1; }while($i <= $pagecount); //Printing option and select echo ("</select>"); ?> <input type="button" name="go" value="Go!" onClick="document.getElementById('im').src=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value+'.png';"> </FORM> <img src="img0.jpg" id="im"> With the current code on bacakomik.php, I only can change the img src of id "im" in the same directory only. What I want is that the Javascript could "add" the "$exploded[0]" variable so that the picture can be loaded from different directory. Anyone can do this? I believe that the fix should be somewhere on input tag inside OnClick, or do you know where? Anyway, I found this on the net http://p2p.wrox.com/php-faqs/11606-q...avascript.html Please help me to those who can... I want to insert this js snippet Code: function addText(smiley) { document.getElementById('message').value += " " + smiley + " "; document.getElementById('message').focus(); return false; } to a loaded iframe with name&id chtifrm. I can access it & change embed something in its html via using something like: Code: $(parent.chtifrm.document.body).append('<div id=\"smly\" style=\"cursor:pointer;float:left;top:200px;display:none;position:absolute;\"><\/div>'); .... Code: parent.chtifrm.document.getElementById('chatbox_option_disco').style.display == 'none' but how do I insert js in the head of loaded iframe? Hi Guys I am trying to modify the functionality of my page. I want to be able to activate this piece of code using another javascript function. This is the code I want to activate: Code: <script type="text/javascript"><!-- $('#button-cart').bind('click', function() { $.ajax({ url: 'index.php?route=checkout/cart/update', type: 'post', data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea, .date_data input[type=\'text\']'), dataType: 'json', success: function(json) { $('.success, .warning, .attention, information, .error').remove(); if (json['error']) { if (json['error']['warning']) { $('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.warning').fadeIn('slow'); } for (i in json['error']) { $('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>'); } } if (json['success']) { $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.success').fadeIn('slow'); $('#cart_total').html(json['total']); $('html, body').animate({ scrollTop: 0 }, 'slow'); } } }); }); //--></script> And this is how I want the format of the function to be: function testsession() { if there is a session called 'hiredate' { activate the script above } else { var el = document.getElementById("product_data"); } } I just dont know how to write this in javascript Could you help me if possible please Hey, I've got to make the values of some textboxes change the co-ordinates of my sprite on a canvas and havent a clue on how to do it, Here is my form with the two textboxes and submit button: <form> x: <input type="text" name="x" /><br /> y: <input type="text" name:"y" /><br /> <input type="submit" value="Submit"/><br /> </form> And i need it so that they change the values of these: //this shows where my sprite will start on the canvas var block_x; var block_y; searched the internet for hours and cant really find anything i understand or works. any help is much appreciated All -- I have a JavaScript config file called gameSetting.js which contains a bunch of variables which configures a particular game. I also have a shared JavaScript library which uses the variables in gameSetting.js, which I include like so: <script type="text/javascript" src="gameSetting.js" ></script> <script type="text/javascript" src="gameLibrary.js" ></script> In gameSetting.js I have: $(document).ready(function() { // call some functions / classes in gameLibrary.js } in Firefox, Safari, and Chrome, this works fine. However, in IE, when it's parsing gameSetting.js, it complains that the functions that live in gameLibrary.js aren't defined. When it gets to parsing gameLibrary.js, the variables in gameSetting.js are reported as not being defined. I've tried dynamically bootstrapping the gameLibrary file using this function in document.ready for dynamic load... $.getScript("gameLibrary.js"); However, the same problem still happens in IE, where when it parses the files individually it's not taking into context the file/variables that came before, so it's not an out of load order problem. My options a 1) collapsing all the functions in gameLibrary.js and variables in gameSetting.js into one file. However, this is not practical because this is dealing with literally hundreds of games, and having a gameLibrary.js in ONE location for ONE update is what makes most logical sense. 2) figure out a way to get this to work where variables in file1 are accessible to file2 in IE (as it seems they are in other browsers). jQuery seems to be able to have multiple plugins that all refer to the based jQuery-1.3.2.js, so I know there is a way to get this to work. Help appreciated. Nero I wrote a log function that took note of various function calls. Thinking that functions are first class objects, and objects have properties, I made the name of each logged function a property of that function, e.g., brightenInnerPara.name = "brightenInnerPara"; Every browser I tried (Firefox, MSIE, Opera, Chrome, Safari) accepted the assignment, no problem. In Firefox and MSIE, the result was what I wanted: brightenInnerPara.name == "brightenInnerPara" But in the others, the result was: brightenInnerPara.name == null Question 1. Which Javascript is correct here? I favor Firefox and MSIE, not merely because they were willing to give me what I wanted, but also because it makes no sense to accept an assignment statement without throwing an error and then give it a null semantics, like Chrome, Opera, and Safari did. I found a workaround, using assignments like this: brightenInnerPara.prototype.name = "brightenInnerPara"; To my surprise, that worked in every browser. But I don't know why. It seems that such assignments are enough to cause each function to have its own distinct prototype. Question 2. Just how inefficient is my workaround, and why does it work? I've got most of it done. Ok heres the project: http://www.gibsonr.com/classes/cop1830/20122/proj6.html *I need help with parts 7-11 Ill show you guys my code: Code: <head> <script type="text/javascript"> /* function divFontSize (big, size) { big.style.fontSize = size; } */ /* function showHide (checkbox, status) { checkbox.display = status } */ </script> <input type="checkbox"> <style type="text/css"> body {background-color:#cccccc;} h2,h3 {text-align:center;} </style> </head> <body> <table style="border-style:groove"> <tr> <td> <form> Show:<input type="checkbox" checked="showHide()" id="objchk"/>Ojectives <input type="checkbox" checked="showHide()" id="detchk"/>Details <input type="checkbox" checked="showHide()" id="subchk"/>Submission </form> </td> </td> </table> <h2>Javascript Objects Project</h2> <html> <div id="objectives" onmouseover="divFontSize(big ,'125%')" onmouseout="divFontSize(big, '100%')"> <h3>Objectives</h3> <p>This project involves the use of event-driven behaviors written as Javascript functions that will control the way in which the page is formatted and displayed. </p> </div> <div id="details" onmouseover="divFontSize(x, '125%')" onmouseout="divFontSize(x, '100%')"> <h3>Details</h3> <ol> <li>Use a plain text editor such as the Windows Notepad program to create a web page named "project6.htm" that displays as closely matching the illustration above as possible. You must not use Word, Wordpad, Dreamweaver, or any other web authoring software.</li> <li>The heading at the top of the page should be a level 2 heading. The other three headings should be level 3.</li> <li>Use <em>embedded</em> CSS rules to center both levels of heading and all other style definitions necessary to format the page. Assign a background color of #cccccc for the page.</li> <li>The content under the the headings OBJECTIVES, DETAILS, and SUBMISSION should be created with division (div) elements that also include the headers.</li> <li>Each division must be given a unique <code>id</code> attribute to identify it to JavaScript functions that will affect it. Name the division elements (in order of appearance): <code>objectives</code>, <code>details</code>, and <code>submission</code>.</li> <li>One JavaScript function named "<code>divFontSize</code>" must be written to cause a "rollover behavior" for any of the three divisions, such that when a user moves a mouse over them they enlarge to a 25% larger font size and then return to their original size when the mouse moves away from them. (It does not matter if the header changes size or not.) The function must receive two passed parameters that indicate (1) the id of the division to be altered, and (2) the font size to be applied to the division.</li> <li>Each division must have two "event handler" attributes that will call the <code>divFontSize</code> function and pass the related parameters to it when the mouse: (1) hovers over the division, and (2) moves away from it.</li> </ol> </div> <div id="submission" onmouseover="divFontSize(x,'125%')" onmouseout="divFontSize(x'100%')"> <h3>Submission</h3> <p>Your script (web page) should be submitted via the project 6 drop box under the lesson tabs of the angel course shell for this course. After completeing your web page, login to the Angel Server and click on the "Lessons" tab on the top of the screen. Select "Project6" and type a title and any message you like in the textboxes. Then use the "Attachments" button to attach your script file to the submission message and press the Submit button. </p> </div> </body> </html> |