JavaScript - Set Onmouseover In Javascript Without Calling/running The Function
Is it possible to set onmouseover only in js file without running the function on html code?
P.S. I found a coding thread here but I don't understand it and it's too old (2005 archive). Thank you very much Similar TutorialsHello I am setting up a Javascript function in a page called functions.php function onAddBookmarkPressed() { <? mail("XXXXXXX", "Mail","Bookmark"); ?> } And calling it from another place within the page <div class="barstepimg"><img src="http://staggan.com/my_dir/images/progress_bar/fb_buttons/add_bookmark.gif" onclick="onAddBookmarkPressed();"/></div> I include functions.php in my index.php page... When I run the index.php page the function above runs and emails me... Any idea why? How can I call a PHP Function inside a Javascript Function? This is what I have so far, but I don't think I'm doing it the right way. Any suggestions? PHP Code: <?php function phpQuery(){ $query = mysql_query("INSERT INTO mytable VALUES('','name','email')"); } ?> <script type="text/javascript"> function delayQueries() { timeoutID = window.setTimeout(doQueries, 2000); } function doQueries() { var runQuery = "<?php phpQuery(); ?>"; } </script> JavaScript Code: window.addEvent('domready',function(){ //SAMPLE 8 var handles8_more = $$('#handles8_more span'); var nS8 = new noobSlide({ box: $('box8'), interval: 5000, autoPlay: true, items: $$('#box8 h3'), size: 900, handles: $$('#handles8 span'), handle_event: 'mouseenter', addButtons: { previous: $('prev8'), play: $('play8'), stop: $('stop8'), playback: $('playback8'), next: $('next8') }, onWalk: function(currentItem,currentHandle){ //style for handles $$(this.handles,handles8_more).removeClass('active'); $$(currentHandle,handles8_more[this.currentIndex]).addClass('active'); //text for "previous" and "next" default buttons $('prev8').set('html','<< '+this.items[this.previousIndex].innerHTML); $('next8').set('html',this.items[this.nextIndex].innerHTML+' >>'); } }); //walk to item 0 witouth fx nS8.walk(0,false,true); }); html Code: <div class="slider sample8"> <p class="buttons" id="handles8"> <span>Item 1</span><span>Item 2</span><span>Item 3</span><span>Item 4</span><span>Item 5</span> </p> <div class="mask1"> <div id="box8"> <div onMouseOver="nS8.Stop();" onMouseOut="nS8.Play();"> </div> </div> </div> <p class="buttons"> <span id="prev8"><< Previous</span> | <span id="next8">Next >></span> </p> <p class="buttons"> <span id="playback8">< Playback</span> <span id="stop8">Stop</span> <span id="play8">Play ></span> </p> </div> All I need to do is when they hover ocer the div statement stop the program from looping. and then when they stop hovering over it let it start looping again. hi i have a sliding vertical menu in my page in the left side and in the right side i have a text say for eg: Home. So when i click on home, i need the left side vertical menu to slide and open and the home in the left side should get highlighted. How do i do this in javascript ???? Pls help!!!! I would like to add some javascript code that used for mobile browser detection to redirect page to another page. I would like to add it to content editor web part in sharepoint. I think I need to add it to the source editor. I got the following javascript code from a website. (function(a,b){if(/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris| kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo| up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1- 6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te| us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa| cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el (49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w| od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\- (20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( | \/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/| ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50| p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok (6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po (ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/| sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl (45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg \-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk (40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)| wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))window.location=b}) (navigator.userAgent||navigator.vendor|| window.opera,'http://www.mycustomizedmobilepage.html'); {/script} I also learned that I need to add this line of code to the page: _spBodyOnLoadFunctionNames.push("functionName"); to call the javascript so that there is some kind of time delay to make the page upload to work correclty with the code. My question is: I see this javascript start with function(a,b), I did't see actually a function name, how can I call this function by using _spBodyOnLoadFunctionNames.push Thanks -------------------------------------------------------------------------------- var macs = { getMacAddress : function() { document.macaddressapplet.setSep( "-" ); document.write( "Mac Address = " + document.macaddressapplet.getMacAddress() ); } how do i call this function and display out in the website? this doesn't seems working.. <script type="text/javascript"> document.write(mac.getMacAddress()); </script> Anyone help? Hi, The point is to have a PHP code on the same page as a javascript calling the PHP function. I am able to make this work when the PHP code is on an external file. But when all but XSL are on the same page, it won't do what it should. How to make this work? The PHP is correct as it is by its self. And so is the javascript as it is for calling other PHP code. The combination of these two in this case just won't work. PHP and Javascript: [CODE] <html ><head><title>Untitled 1</title></head> <body> <?php function dateToDayOfWeek($xmlDate, $useFormat = 'l') { $rd = 'Unknown'; if (count($xmlDate) == 1) { $element = $xmlDate[0]; if ($element instanceof DOMElement) { $rd = date($useFormat, strtotime($element->nodeValue)); } } return $rd; } function axasal(){ date_default_timezone_set('UTC'); $xslDoc = new DOMDocument(); $xslDoc->load("xslfile.xsl"); // Here comes the xsl file name. $xmlDoc = new DOMDocument(); $xmlDoc->load("http://free.worldweatheronline.com/feed/weather.ashx?q=milan,italy&format=xml&num_of_days=5&key=af8b2fc417222733111712"); $proc = new XSLTProcessor(); $proc->registerPHPFunctions('dateToDayOfWeek'); $proc->importStylesheet($xslDoc); echo $proc->transformToXML($xmlDoc); } ?> <script type="text/javascript"> function call_php(){ document.getElementById("place").innerHTML="<?php echo axasal(); ?>"; } </script> <form name = "form"> <input type = "button" name = "aaa" id = "aaa" value = "Click me" onclick = "call_php()" /> </form> <div id="place"></div> </body></html> [CODE] XSL: [CODE] <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlnshp="http://php.net/xsl"> <xsl:template match="data"> <html> <head><title></title></head> <body> <table> <tr> <xsl:apply-templates select="./weather" /> </tr> </table> </body> </html> </xsl:template> <xsl:template match="weather"> <td style="width: 97px"> <p><xsl:value-of select="php:function('dateToDayOfWeek', date)" /></p> <p><xsl:apply-templates select="./weatherIconUrl" /></p> </td> </xsl:template> <xsl:template match="weatherIconUrl"> <img> <xsl:attribute name="src"> <xsl:value-of select="." /> </xsl:attribute> </img> </xsl:template> </xsl:stylesheet> [CODE] The smiley face on the second line of the last code is ':' and 'p'. Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 2</title> </head> <SCRIPT LANGUAGE = JavaScript> function estimateHolidays() { var service1; var service2; var service3; var txtGrade; var txtHolidays; var dblEntitlement; var strService; strService = cmbService.value; if (strService == "Service1") { dblEntitlement = 20; } else if (strService == "Service2" && Grade--"1") { dblEntitlement = 24; } else if (strService == "Service2" && Grade--"2") { dblEntitlement = 26; } else if (strService == "Service2" && Grade--"3") { dblEntitlement = 28; } else if (strService == "Service3") { dblEntitlement = 30; } else { dblEntitlement = "Error! Please try again."; } txtHoliday.value = dblEntitlement; } </SCRIPT> <body> <p> <input name="txtGrade" size="25" value="Enter Your Staff Grade"> </p> <p> Years of Service: <select name="cmbService" size="1"> <option value="Service1">Less than 5 years service</option> <option value="Service2">5 to 9 years service</option> <option value="Service3">10 or more years of service</option> </select> </p> <p> <input type="button" value="Estimate Holidays" name="cmdEstimateHolidays" onclick="estimateHolidays()"> </p> <p> Holiday Entitlement: <input name="txtHolidays" size="25"> </p> </body> </html> Why won't this code work!? Its driving me mad. I have a page that loads various "applications" into an iframe inside the main page. One of the applications loaded calls a javascript function that is loaded with the "application" page. It works great in Safari, Chrome & Firefox but error's out in IE8 - "Object doesn't support this action". Anyone know why ? Have other calls that work but this one is the only one that uses href Thanks, JerryB [CODE] <div id = 'trainingsubmitbutton' style='display:none;'><a href='javascript: submitdata(0)'>Submit This Record</a></div> [CODE] First of all, I must say that I am recently introduced to JavaScript and I am not fully aware of its complete functionality. So I have an HTML document which has defined within a its body a JavaScript function and I have also a JApplet class which is also loaded in the HTML and can call the JavaScript function. But I have also another Java class which is not an applet and I would like to find a way for this class to be able to call the JavaScript function (but it is essential for this class not to be an applet). I am aware that this would raise some security concerns but it is for local usage and I am interested to hear some ways if possible for this to be done. Thank You beforehand to all of you! I have a function which I placed in the header of my html file: Code: <script language="javascript" type="text/javascript"> function UngreyInstallButtons() { document.form1.viewbutton1.disabled = false; document.form2.viewbutton2.disabled = false; document.form3.viewbutton3.disabled = false; } </script> I want to call this from within the body of my html page: Code: <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"> <!-- var name = GetCookie('COOKIENAME'); if (name != null) { alert("I GET HERE" + name + "!"); UngreyInstallButtons(); alert("I DONT MAKE IT HERE"); } //--> </SCRIPT> The GetCookie func works and returns name correctly. The first alert() box is displayed, - the second one isn't! It does not come back from the call to UngreyInstallButtons() Why? I also tried this: Code: if (name != null) { alert("I GET HERE" + name + "!"); document.form1.viewbutton1.disabled = false; document.form2.viewbutton2.disabled = false; document.form3.viewbutton3.disabled = false; alert("I DONT MAKE IT HERE"); } Again, it does not execute the = false lines at all. Perhaps I'm missing something obvious? (I am new to js) I have 2 pages, If in test.php i include test2.php everything is working perfect, but if the page appear the script is not working. Can someone help me find a problem? test.php PHP Code: <head> <script> function Show_test2(){ var ajaxRequest; try{ ajaxRequest = new XMLHttpRequest(); } catch (e){ try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } var ot = document.getElementById('over_time').value; var queryString = "?ot=" + ot; ajaxRequest.open("GET", "test2.php" + queryString, true); ajaxRequest.send(null); ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('Show_test2'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } } </script> </head> <body> <?php //include ("test2.php"); $year = 2014; if(!empty($year)) { echo 'Over Time: '; echo ' <select name="over_time" id="over_time" onclick="Show_test2()"> <option value="1">0</option> <option value="2">1</option> <option value="3">2</option> <option value="4">3</option> <option value="5">4</option> <option value="6">5</option> </select> <br/>'; echo '<div id="Show_test2"></div>'; } ?> </body> test2.php PHP Code: <html> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(function() { $('input[name^="player"]').keyup(function(event) { var player = $(this).attr("name").split('_'); player = player[1]; var player_sum = 0; $('.player_'+player).each(function(index, el) { var pt = parseInt($(el).val()); if(!isNaN(pt)) { player_sum += pt; } }); $('#sum_'+player).html(player_sum); }); }); </script> <body> <?php echo 'first half<br>'; for ($i=1;$i<4;$i++){ echo "gracz".$i.": <input type='text' class='player_".$i."' name='player_".$i."' size='1' maxlength='2'> "; } echo '<br><br>'; echo 'second half<br>'; for ($i=1;$i<4;$i++){ echo "gracz".$i.": <input type='text' class='player_".$i."' name='player_".$i."' size='1' maxlength='2'> "; } echo '<br><br>'; for ($i=1;$i<4;$i++){ echo "gracz".$i.": <span id='sum_".$i."'>0</span> "; } echo '<br><br>'; ?> </body> </html> Thanks <p> <script type="text/javascript">// <![CDATA[ var metrics = { "mm" : 1, "cm" : 10, "m" : 1000, "inch" : 25.4, "foot" : 304.8 }; function convert(num, dec){ var val = document.getElementById("fromVal").value; if(isNaN(val)){ return } function roundNumber(num, dec) { var result = Math.round( Math.round( num * Math.pow( 10, dec + 1 ) ) / Math.pow( 10, 1 ) ) / Math.pow(10,dec); return result; } document.getElementById("toVal").value = val * metrics[document.getElementById("fromSystem").value]/ metrics[document.getElementById("toSystem").value]; } var interval = null; function watchChanges(){ interval == null ? setInterval("convert()", 500) : clearInterval(interval); } // ]]></script> </p> <table> <tbody> <tr> <td><input id="fromVal" style="width: 100px;" onfocus="watchChanges()" onblur="watchChanges()" type="text" /><select id="fromSystem" onchange="convert()"> <option value="mm">millimeters</option> <option selected="selected" value="cm">centimeters</option> <option value="m">meters</option> <option value="foot">feet</option> <option value="inch">inches</option> </select></td> </tr> <tr> <td colspan="1" align="center">=</td> </tr> <tr> <td><input id="toVal" style="width: 100px;" type="text" disabled="disabled" /><select id="toSystem" onchange="convert()"> <option value="mm">millimeters</option> <option value="cm">centimeters</option> <option value="m">meters</option> <option selected="selected" value="foot">feet</option> <option value="inch">inches</option> </select></td> I have changed my event listener around a bit. Basically the "compare_fields" function is running when the "load_doc" function is run. Here is my JavaScript: PHP Code: function load_doc(doc, parent) { document.getElementById(parent).innerHTML = "<h1>Loading...</h1>"; var http = getHTTPObject(); if (http != undefined) { http.onreadystatechange = function() { req_doc(doc, parent, http); }; http.open("GET", doc, true); http.send(""); } } function req_doc(doc, parent, req) { if (req.readyState == 4) {//only if req is loaded if (req.status == 200) {//And if its okay document.getElementById(parent).innerHTML = req.responseText; add_event_listeners(page) } else { document.getElementById(parent).innerHTML = "Error fetching data: " + req.status + "\n" + req.statusText; add_event_listeners(); } } } //Script used to hide elements. Usage: expand(element id) function expand(elm) { var ex = document.getElementById(elm).style.display; if (ex == "none") { var obj = document.getElementById(elm); obj.style.display = "inline"; } else if (ex == "inline") { var obj = document.getElementById(elm); obj.style.display = "none"; } } function check_database(obj) { //Not written yet } //Function to test the password validation, should rewrite in future //to make it multifunctional function compare_fields(obj) { alert("com"); var field2 = obj.split("_"); field2 = document.getElementById(field2[1]+"2"); if (obj == field2) { if (obj.length >= 4) { document.getElementById("pass_status").style.color = "#00CC00"; document.getElementById("pass_status").innerHTML = "OK!"; } else { document.getElementById("pass_status").innerHTML = "Please must be between 5 - 14 characters long! "; document.getElementById("pass_status").style.color = "#FF0000"; } } else { document.getElementById("pass_status").innerHTML = "Passwords do not match!"; document.getElementById("pass_status").style.color = "#FF0000"; } } Global JavaScript: PHP Code: //Get httpobject function getHTTPObject() { var http = false; if (window.XMLHttpRequest) { http = new XMLHttpRequest(); } else if (window.ActiveXObject) { http = new ActiveXObject("Microsoft.XMLHTTP"); } return http; } //This function attaches events to elements. var addEvent = function( elm, evt, fun ) { if ( elm.addEventListener ) { elm.addEventListener( evt, fun, false ); } else if ( elm.attachEvent ) { elm.attachEvent( 'on' + evt, fun ); } else { elm [ 'on' + evt ] = fun; } }; Here is the first form, this contains the button: Code: <div style="border-color:#09C; border-width:1px; border-style:solid;"> <div class="register_button" onClick="load_doc('pages/forms/register_form.php', 'login_form')">Register</div> <h1>Login</h1> <h3>DrawSomething - WordGuesser</h3> <br /> <form id="login" action="php/check_login.php" method="post"> Username<br /><input type="text" name="username" class="text login_field"><br /> Password<br /><input type="password" name="password" class="text login_field"><br /> <input type="submit" value="Login" class="button blue" /> </form> <br /> <h2>Forgot Username/Password?</h2> <span class="expand" onClick="expand('forgot_p')"></span> <form class="forgot_p" action="php/forgot_p.php" method="post" style="display:none;" id="forgot_p"> Email<br /> <h3>Recover username</h3> <input type="text" name="forgot_email" class="text login_field"><br /> <span style=" font-weight:bold; font-size:21px;">- OR -</span><br /> Username<br /> <h3>Recover password</h3> <input type="text" name="forgot_password" class="text login_field"><br /> <input type="submit" value="Recover" class="button" /> </form> </div> Form which is loaded, this is when the "comare_fields" function is run when it shouldn't be. Edit: Oh and here is the PHP script which creates the event listeners. PHP Code: include "js/common.js"; include $js[$page]; //Write JS variables for event listeners $page_listeners = $listeners[$page]; //Check if there are some event listeners for this page if (count($page_listeners) > 0) { ///Start function echo "function add_event_listeners() { "; //Start loop to add event listeners for ($i = 0; $i < count($page_listeners); $i++) { $doc_elm = "document.getElementById('".$page_listeners[$i][1]."')"; echo "addEvent(\"document.getElementById('".$page_listeners[$i][0]."')\", \"".$page_listeners[$i][1]."\", ".$page_listeners[$i][2].");"."\n"; } //End function echo "}"; } Code that is written with the above PHP Code: function add_event_listeners() { addEvent("document.getElementById('reg_username')", "click", check_database); addEvent("document.getElementById('reg_email')", "click", check_database); addEvent("document.getElementById('reg_password')", "click", compare_fields('reg_password')); } And here are global PHP variables: PHP Code: <?php //Define page titles $titles = array( "login" => "Login - DrawSomething", "main" => "DrawSomething - Word Guesser", "admin" => "Administrator" ); //Require JavaScript files when onscreen HTML is selected $js = array( "login" => "js/login_js.js", "main" => "js/main_js.js", "admin" => "js/admin_js.js" ); //Pages to require $pages = array( "login" => "pages/login_page.php", "main" => "pages/main_page.php", "admin" => "pages/admin_page.php" ); //Event listeners to add $listeners = array( "login" => array(array("reg_username", "click", "check_database"), array("reg_email", "click", "check_database"), array("reg_password", "click", "compare_fields('reg_password')") ), ); ?> hi. how can i get the value of title of<td> on onmouseover function. something like that. Code: <td title="mytitle" onMouseOver="func(this.title);"></td> can i do this. plzzzz help me I have six small images. Depending on which image a user hovers over, I would like a seventh image (a simple box) to change as well. For example, if a user hovers over image1, I want the seventh image to be a red box. If a user hovers over image2, the seventh image should be a blue box. Simple huh? So the seventh image changes color based on which of the six smaller images the user hovers over. ------------- So far, my current code only allows me to hover over any of the six images, and the seventh image always changes to the same image color. Code is below. Any help would be appreciated. Code: <script type="text/javascript"> function hoverBox() { var boxNumber; document.getElementById("info").src = "Images/infoRedColor.png"; } function hoverBoxOut() { document.getElementById('info').src = "Images/info.png;" } </script> </head> <body> <div id="wrapper"> <a href=""> <img class="box1" src="Images/box1.png" border="0" onmouseover="this.src='Images/box1hov.png'; hoverBox()" onmouseout="this.src='Images/box1.png'; hoverBoxOut()" ></a> <a href=""> <img class="box2" src="Images/box2.png" border="0" onmouseover="this.src='Images/box1hov.png'; hoverBox()" onmouseout="this.src='Images/box2.png'; hoverBoxOut()"></a> <a href=""> <img class="box3" src="Images/box3.png" border="0" onmouseover="this.src='Images/box1hov.png'; hoverBox()" onmouseout="this.src='Images/box3.png'; hoverBoxOut()"></a> <a href=""> <img class="box4" src="Images/box4.png" border="0" onmouseover="this.src='Images/box1hov.png'; hoverBox()" onmouseout="this.src='Images/box4.png'; hoverBoxOut()"></a> <a href=""> <img class="box5" src="Images/box5.png" border="0" onmouseover="this.src='Images/box1hov.png'; hoverBox()" onmouseout="this.src='Images/box5.png'; hoverBoxOut()"></a> <a href=""> <img class="box6" src="Images/box6.png" border="0" onmouseover="this.src='Images/box1hov.png'; hoverBox()" onmouseout="this.src='Images/box6.png'; hoverBoxOut()"></a> <!-- Seventh Image --> <img id="info" src="Images/info.png" border="0"> </div> </body> Hi, I am working on a google map where you can show lines on the map by checking checkboxes. Lines are displayed according to their category attribute in the xml file. The function that picks up the checkbox click is like this: Code: function boxclick(box,category) { if (box.checked) { show(category); } else { hide(category); } Another part of the code assigns that category attribute to arrows, so that when a line of "x" category is displayed, the relevant arrows are displayed along with it, to indicate directionality. I also have a select list which displays the lines by looping through their array and using selectedIndex in a function called handleSelected2. But I can't get the arrows to display along with the lines from the select box. After trying many, many things, I figure that all I need to do is to call the show(category) function from inside the handleSelected2 function and it should all come together. So I came up with this: Code: function handleSelected2(opt,category) { for (var h = 0; h <gpolylines.length; h++) { gpolylines[h].hide(); } h = opt.selectedIndex - 1; if (h > -1) { gpolylines[h].show(); } for (var v=0; v<pts.length; v++) { show(category); } } which gets me lines, but no arrows. You can see it sort of working he http://www.xelawho.com/map/zonesarrowstest.htm I figure I've got to be close, because if I just tell it to show all the arrows (without going through the category filter) like this: Code: function handleSelected2(opt,category) { for (var h = 0; h <gpolylines.length; h++) { gpolylines[h].hide(); } var h = opt.selectedIndex - 1; if (h > -1) { gpolylines[h].show(); } for (var i=0; i<pts.length; i++) { pts[i].show(); } } then all the arrows show up, as you can see he http://www.xelawho.com/map/zonesarrowstest2.htm I'm not getting any error messages and I've tried pretty much everything I can think of... I've been tweaking this for days and it's driving me crazy. Does anybody else have any ideas? Thanks in advance. I have an external js file which contains the function which for now opens an alert box. The div on the page should run the function when it is clicked but it isn't. I have tried changing the function to an alert to check the click event is working and i have tried running the javascript in the address bar Code: javascript:hasFocus(); to ensure it has loaded correctly. Both are working fine and i am getting no errors. Below is a snippet of the code: Code: function hasFocus() { alert("a"); } Code: <!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> <script type="text/javascript" language="javascript" src="scripts/cms.js"></script> </head> <body> <div id="tab_panel"> <div id="tabs"></div> <div id="content" contenteditable="true" onclick="hasFocus();"></div> </div> </body> </html> Thanks in advance It would be great if anyone can help me with this list-scrolling animation problem. The animation works fine but I want another action to execute only after the animation finishes. Made several unsuccessful attempts, but here is the basic code. Code: function coreAnimate(obj, elm, begin, end, duration, fps) { if(!duration) duration = 1000; if(!fps) fps = 20; begin = parseFloat(begin); end = parseFloat(end); duration = parseFloat(duration); fps = parseFloat(fps); var change = end-begin; var interval = Math.ceil(1000/fps); var totalframes = Math.ceil(duration/interval); var step = change/totalframes; for(i = 1 ;i <= totalframes; i++) { (function() { var frame=i; function inner() { var increase = linearTween(frame, begin, change, totalframes); unit = 'px'; obj.style[elm] = increase+unit; }; timer = setTimeout(inner,interval*frame); }) (); }; }; function linearTween(t, b, c, d) { return c*t/d + b; }; Thanks, Chris Hey all, I have a little function that performs when a form item is selected. I would like to give the form items all at once and have the function perform when the user mouses over an item in the displayed list. Here is the form code: Code: <form> <select onchange="showRSS(this.value)"> <option value="">Select an RSS-feed:</option> <option value="Google">Google News</option> <option value="MSNBC">MSNBC News</option> </select> </form> thanks a bunch, Brian p.s. I tried this but it didn't work Code: <?php echo("<a href=\"http://www.msn.com\" onMouseover=\"showRSS(this.MSNBC)\">MSNBC News</a>");?> <br /> <?php echo("<a href=\"http://www.google.com\" onMouseover=\"showRSS(this.Google)\">Google News</a>");?> <br /> |