JavaScript - Document.body.scrolltop
I'm trying to implement saving the document.body.scrollTop value and then restoring it but the restore does not work.
The SetScrollLocation() alert line is empty. The save alert() lines displays a value so its saving the scrollTop but it seems to loose the value on the SetScrollLocation() call. I'm saving on an OnClick event and then restoring when the form reloads from a refresh. PHP Code: function SaveScrollLocation () { document.forms[0].frm_body_hidden.value = document.body.scrollTop; alert(document.forms[0].frm_body_hidden.value); } function SetScrollLocation () { alert(document.forms[0].frm_body_hidden.value); document.body.scrolltop = document.forms[0].frm_body_hidden.value; } Similar TutorialsThis code not work, Code: if( document.body.scrollTop() > 200 ) { $( '.navigation' ).addClass( 'fixed' ); } else { $( '.navigation' ).removeClass( 'fixed' ); } I want it to work without jQuery, because half my site die's when i use jQuery, jsut want a simple scrollTop script for when im 200px from top it locks navigation fixed top the top, it works with jQuery but not without and been trying for hours to get it to work, any help would be kindly recieve thanks. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <script language="javascript" type="text/javascript"> alert (document.body); </script> </head> <body> </body> </html> EDIT: moved script to after body, and now it works. Not the way it should be done I think ? I'm currently working on an HTML executor and would like users to be able to put javascript in their code if they wish to do so. Currently I have their input sent to an iframe via document.body.innerHTML. The problem, though, is that user submitted javascript doesn't work (with the exception of anything placed in the onload attribute of an image). Any suggestions?
Hi, thanks for reading, I have to admit, I'm a noob, but what my code does drives me nuts, eternal thanks to whoever tries to help me out! In short my problem is that document.body.scrollHeight does not give me the correct pagesize combined with the viewport. I just want the parts of the page to be as long as the (in the original dynamicly entered) text in the middle. Imho pageheight = (document.body.scrollHeight+viewportheight); should give me the correct height of the page, but does not, why? It works and it is close, but not completely, I tried stuff like document.body.offsetHeight etc., but my guess is I miss facturing in a parameter, but I have not the slightest clue which... Here the page: http://buchenbergschule.de/ruh/depre...ode/test7.html Here the JS Code: Code: <script type="text/javascript"> <!-- var viewportwidth; var viewportheight; var pageheight; if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth, viewportheight = document.documentElement.clientHeight } else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth, viewportheight = document.getElementsByTagName('body')[0].clientHeight } pageheight = (document.body.scrollHeight+viewportheight); document.write('<style type=text/css> div#linksaussen'); document.write('{width:468px; height:'+(pageheight-896)+'px; position:absolute; top:896px; left:'+(((viewportwidth-948)*0.5084)-468)+'px; background-image:url(./images/back_links.png);}'); document.write('div#linksaussen1 {width:468px; height:897px; position:absolute; top:0px; left:'+(((viewportwidth-948)*0.5084)-468)+'px; background-image:url(./images/testlinks.png);}'); document.write('div#mitte {width:948px; height:'+pageheight+'px; position:absolute; top:0px; left:'+((viewportwidth-948)*0.5084)+'px; background-color:#FF0000;}'); document.write ('div#rechtsaussen1'); document.write ('{width:'+((viewportwidth-948)*0.4916)+'px; height:897px; position:absolute; top:0px; left:'+(948+((viewportwidth-948)/2))+'px; background-image:url(./images/testrechts.png); background-repeat:no-repeat;}'); document.write ('div#rechtsaussen'); document.write ('{width:'+((viewportwidth-948)*0.4916)+'px; height:'+(pageheight-896)+'px; position:absolute; top:896px; left:'+(948+((viewportwidth-948)/2))+'px; background-image:url(./images/back_rechts.png);}</style>'); alert (viewportwidth+'vpw'+viewportheight+'vph'+pageheight+'pgh') //--> </script> Again please forgive my noobishness, my bad english and thanks again for any hint! I'm not a JS programmer, I stumble around. I have a web page that uses: d = document.createElement("script"); d.type = "text/javascript"; d.src = "/var/www/html/UpDist.php"; return (document.body.appendChild(d)); <-- what I want to do UpDist.php returns a value that I need to continue and I can't get the above code to work - UpDist runs, the return value doesn't. Thanks Chuck I wanted to resize the modal dialog based on the content of the modal dialog for that i used the following lines of code, window.dialogWidth = document.body.scrollWidth+ "px"; window.dialogHeight = document.body.scrollHeight+ "px"; The 'document.body.scrollHeight' is not giving the exact height of the modal dialog bcos the button on the modal dialog are not completely visible to click for the user. Please can any one tell how to get the exact height of the modal dialog to resize it? Hi I have a code which allows a set few images to be used in a slide-show type style for switching the documents background image which displays a set few images which are declared in an object array. Basicly I have it all working perfectly with a "Timer" object value so you can set your own display length per picture but what I can't seem to do is make a cross-browser image fade transaction which works for background images, Here is the code I wrote and how its used, if anyone can help with links or examples that would be a very big help. ORIGINSlide.js Code: /******************************************* * * * ORIGIN Background Image SlideShow * * Build 1.090.350.09 * * * * @Author: CMBSystems (Chris Bearcroft) * * @Copyright: CMBSystems * * @Created: 11/6/2010,1:24 AM (GMT) * * * *******************************************/ (function($){ $.ORIGIN = { // Starting The ORIGIN Class Background: { // Starting The Background Sub-Class Default: 0, // Default Array Key ID Element: [], // Creating The Object For The Background Element Slide: function() { // Starting The Slide Function // Setting-Up The Element For Use In Update $.ORIGIN.Background.Element = arguments[0]; // Updating The Document Body Background Image setInterval('ORIGIN.Background.Update()',$.ORIGIN.Background.Element.Timer); }, Preload: function(img) { // Starting The Preload Function // Preload The Given Image Ready For Displaying var loadIMG=new Image(); // Setting The Source For The Given Image loadIMG.src=img; }, Update: function() { // Starting The Update Function if($.ORIGIN.Background.Element.Images !== undefined) { if($.ORIGIN.Background.Default == $.ORIGIN.Background.Element.Images.length - 1) { // Set Default Value As 0 $.ORIGIN.Background.Default = 0; // Preload Next Image $.ORIGIN.Background.Preload($.ORIGIN.Background.Element.Images[$.ORIGIN.Background.Default + 1]); } else { // Set Default Value As Current Array Key ID $.ORIGIN.Background.Default = parseInt($.ORIGIN.Background.Default + 1); // Preload Next Image $.ORIGIN.Background.Preload($.ORIGIN.Background.Element.Images[$.ORIGIN.Background.Default + 1]); } // Set Document Body Background As The New Image document.body.style.backgroundImage = "url("+$.ORIGIN.Background.Element.Images[$.ORIGIN.Background.Default]+")"; } } } }; })(window); Hoe to use:- Code: <!DOCTYPE html> <html> <head> <title>Untitled Document</title> <style type="text/css"> body { background: #000000 url(images/1.jpg) bottom fixed no-repeat; } </style> <script src="ORIGINSlide.js" type="text/javascript"></script> <script type="text/javascript"> ORIGIN.Background.Slide({ "Timer":5000, "Images": [ "images/1.jpg", // !IMPORTANT - Same image as the default background image. "images/2.jpg", "images/3.jpg" ] }); </script> </head> <body> </body> </html> If anyone can help me please do, Thank You DJCMBear ♫♫ Ok, so I'm working on a What-You-See-Is-What-You-Get editor, and it works flawlessly - with standards. I'm trying to work out bugs it has with IE, this one is particularly tricky: When the page loads, the editor should be inialized, and the inner HTML of the body of the iframe should set to specified text. This seems to work fine in standards-compliant browsers - Webkit, Firefox. But nothing is written to the body when when the page loads in IE, here's the gist of the code for reference: Code: function loadText(){ document.getElementById("edit").contentWindow.document.body.innerHTML = "predefined text"; } window.onload = loadText; The oddest part, is if I come from a new page to the editor in IE, the text doesn't appear. But when I refresh in IE, the text appears for a split second and disappears. Any help on this matter is greatly appreciated! Hello, I was wondering why my code is perfectly working in Firefox, but does not work in Internet Explorer at all: Code: <script language="javascript"> <!-- document.body.onload=document.body.appendChild(document.getElementById('testdiv')); --> </script> I don't get any error messages, the div is just not showing how it is supposed to show with body as parent. Any suggestions? Thanks Hey this is my java script it works fine in FF , but in IE it shows type mismatch error .It shows my innerhtml page and also runs my script but i want to remove the type mismatch error would really appreciate your help.Thank you . Here is my javascript function function submitForm(){ // create request var xmlhttp = null; var serverhttp=null; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); serverhttp=new XMLHttpRequest(); if ( typeof xmlhttp.overrideMimeType != 'undefined') { xmlhttp.overrideMimeType('text/xml'); serverhttp.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); serverhttp = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert('Perhaps your browser does not support xmlhttprequests?'); return; } // submit in JSON notation var email = document.customer.elements[0].value; var companyName = document.customer.elements[1].value var input = '{email:"'+email+'",company_name:"'+companyName+'"}'; var url = "URL"; var cgi = "URL/script.cgi"; xmlhttp.open('POST',url,true); //serverhttp.open('POST',url,true); // show feedback xmlhttp.onreadystatechange = function (aEvt) { var newDiv = document.createElement("div"); newDiv.innerHTML = "<b>Thank You!</b>"; //type mismatch occures over here document.body.replaceChild(newDiv,document.customer); serverhttp.open('POST',cgi,true); serverhttp.send(companyName); } xmlhttp.send(input); } Hey this is my java script it works fine in FF , but in IE it shows type mismatch error .It shows my innerhtml page and also runs my script but i want to remove the type mismatch error would really appreciate your help.Thank you . Here is my javascript function function submitForm(){ // create request var xmlhttp = null; var serverhttp=null; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); serverhttp=new XMLHttpRequest(); if ( typeof xmlhttp.overrideMimeType != 'undefined') { xmlhttp.overrideMimeType('text/xml'); serverhttp.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); serverhttp = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert('Perhaps your browser does not support xmlhttprequests?'); return; } // submit in JSON notation var email = document.customer.elements[0].value; var companyName = document.customer.elements[1].value var input = '{email:"'+email+'",company_name:"'+companyName+'"}'; var url = "URL"; var cgi = "URL/script.cgi"; xmlhttp.open('POST',url,true); //serverhttp.open('POST',url,true); // show feedback xmlhttp.onreadystatechange = function (aEvt) { var newDiv = document.createElement("div"); newDiv.innerHTML = "<b>Thank You!</b>"; //type mismatch occures over here document.body.replaceChild(newDiv,document.customer); serverhttp.open('POST',cgi,true); serverhttp.send(companyName); } xmlhttp.send(input); } Hi all, The following script is scrolling my page smoothly, as it is supposed to, in IE and FF however it is not working at all in Safari, any version. The page is: www.christiantate.net When working correctly, you click the nav buttons in the left sidebar, the page scrolls to the appropriate section. The script: Code: $(function(){ $('a[href*=#]').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']'); if ($target.length) { var targetOffset = $target.offset().top-100; $('html,body').animate({scrollTop: targetOffset}, 1000); return false; } } }); }); Any help would be greatly appreciated. Thanks Hi, I'm working on a blog design. (See code below.) I'd like to fix #title vertically so that when people scroll down the blog, it stays in view in the window. I couldn't think of a CSS way to do it. Using position:fixed doesn't work because if someone is viewing the site from a netbook, or simply from a downsized browser on their normal computer, #title is either cut off -- if it's positioned relative to the left -- or it overlaps the blog content -- if it's positioned relative to the right. I've read suggestions to use Javascript but my Javascript skills are practically non-existent. The suggestions were to use an onscroll handler, and to use scrollTop. This is what I wrote but (probably for obvious reasons) it isn't working: Code: window.onscroll = verticalFix(); function verticalFix() { var sidebar = document.getElementById("title"); sidebar.style.top = .scrollTop(30); } Any advice? Also, .scrollTop is jQuery, right? So I have to link to jQuery? How do I do that, again? Thanks for your help! Here's my html and css: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <style type="text/css"> body,p,#title { padding:0; border:0; margin:0; } body { height:100%; background-color:#fdf5a2; min-width:1056px; } #content { width:700px; padding:15px; border:0; margin:0; margin-left:16px; background-color:white; background-image:url(''); background-repeat:repeat-y; } #title { background-color:white; background-image:url(''); background-repeat:no-repeat; position:absolute; left:755px; top:30px; height:151px; width:292px; } </style> </head> <body> <a href=""><div id="title"> </div></a> <div id="content"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a sem vel nibh interdum egestas sit amet eu tortor. Donec vitae enim risus, quis ultrices metus. Donec vitae mi nibh. Morbi sed placerat metus. Curabitur auctor eros eget odio fermentum et fringilla ante hendrerit. Fusce at tempor libero. Maecenas et iaculis velit. Nulla sit amet lacus enim, vitae hendrerit metus. Donec a risus nunc. Etiam accumsan, ligula sit amet molestie dictum, turpis orci blandit justo, nec porttitor dui ante bibendum risus. Praesent luctus luctus tortor posuere tincidunt. Phasellus ante elit, sollicitudin id dignissim id, bibendum vel nulla.<br /><br />Vivamus vitae elit sed quam consequat interdum sed sit amet ante. Aliquam euismod ipsum non elit sagittis vulputate. Praesent id libero est. Aliquam eget hendrerit nibh. Donec ut sapien massa, vitae consectetur odio. Nunc ut convallis mauris. Donec nisi neque, cursus vitae faucibus a, sagittis et ipsum. Fusce vitae felis augue. Sed eu venenatis enim. Sed pharetra elementum vestibulum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi tincidunt euismod vehicula. Sed facilisis imperdiet pellentesque. Suspendisse ac orci et odio dignissim sodales eget pharetra erat. Etiam arcu odio, adipiscing sed sollicitudin in, egestas et orci. Donec id diam eget libero ultrices tincidunt id et dolor. Etiam malesuada tortor in mi pretium ultricies. Sed faucibus, dolor aliquam pulvinar lobortis, nulla neque condimentum dolor, vel hendrerit lorem elit id ipsum.<br /><br />Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse fringilla luctus ipsum, a suscipit dolor volutpat vitae. Nunc feugiat magna quis lorem porttitor a accumsan mauris pharetra. Mauris eget lectus sit amet mauris tincidunt congue non vitae massa. Donec mi mi, iaculis ut congue ut, aliquam ut est. Ut varius ultricies vulputate. Proin aliquet massa ac nulla volutpat dictum. Donec aliquam diam vel odio rutrum vitae tincidu t felis dapibus. Donec diam velit, elementum eget rutrum sed, congue eget sapien. Integer aliquet cursus pulvinar. Sed varius diam rhoncus metus tristique semper. Donec mauris enim, porttitor a eleifend at, porttitor id nisl. Donec est tellus, pellentesque tempor egestas sed, eleifend id dui. Nulla euismod erat non tellus bibendum quis vehicula odio faucibus. Cras enim turpis, pulvinar ac facilisis sit amet, egestas eu metus. Fusce orci sapien, sagittis non iaculis pharetra, fermentum non augue. Aliquam velit erat, facilisis at faucibus ut, semper sed velit. Proin ac sapien magna.<br /><br />Duis vestibulum varius orci vel tempor. Maecenas id magna nibh, id aliquam mauris. Aliquam auctor metus eget metus hendrerit sed luctus nisi convallis. Mauris faucibus interdum felis ac vestibulum. Aenean ut quam quis velit imperdiet fringilla nec tempor magna. Nam vel neque a justo cursus varius. Nam in erat ante. In convallis mi in tellus tempus id mollis ipsum cursus. Nam a ultrices nulla. Nullam pellentesque interdum ligula, quis mattis ante pharetra et.<br /><br />Etiam nisi nibh, tempus eu tincidunt lobortis, cursus sed ligula. Nam vitae elit purus, id facilisis purus. Fusce lorem quam, porta eget sodales quis, luctus eget mi. Fusce scelerisque, justo vestibulum varius porta, tellus nulla bibendum mi, non adipiscing neque leo vitae mi. Donec posuere, lacus eu lobortis rutrum, eros nulla iaculis orci, sed mollis orci purus rhoncus sapien. Fusce ac enim diam, quis posuere enim. In faucibus, sem a tincidunt mollis, eros nisl faucibus diam, ut volutpat dolor arcu quis augue. Sed iaculis justo auctor nulla vestibulum congue. Cras venenatis, sem non ullamcorper eleifend, risus tellus semper sem, quis fermentum mi nulla id metus. Fusce at placerat lacus. Sed tristique, velit id ultrices sollicitudin, massa tellus vehicula neque, in dignissim sapien nisl a ante. Etiam varius tristique ante et eleifend. Aliquam erat volutpat. Mauris luctus tristique eros, vehicula pharetra purus convallis vitae. Suspendisse porta condimentum magna in luctus. Aliquam erat volutpat.<br /><br />In dui risus, consequat sed sagittis pretium, fringilla a est. Vivamus gravida, est vel cursus tristique, est est aliquet quam, quis fermentum quam neque et justo. Nulla eu urna eu sapien rutrum varius eget id odio. Sed lacinia tristique purus ac auctor. Nam ornare auctor mauris, ac pharetra nisl dignissim sed. In hac habitasse platea dictumst. Suspendisse potenti. Donec eleifend malesuada orci vitae posuere. Vivamus mattis vestibulum ante, mattis pellentesque magna sagittis id. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum congue nunc ac felis volutpat vel vestibulum libero pulvinar. Duis rutrum dui non libero mollis ultrices. Vestibulum et sapien ac justo tristique rutrum. Duis nec nibh eros, eu pretium mauris. Ut tristique eleifend elementum. Duis id leo id nisl commodo sagittis at a elit. Cras aliquet, nibh a bibendum ultricies, nisl nisl posuere justo, in feugiat enim nunc non eros. Pellentesque vitae dui eget metus molestie sodales. Aenean id augue leo, a bibendum felis.<br /><br />Donec tristique laoreet lobortis. Aenean vestibulum congue mauris vitae suscipit. Maecenas in euismod orci. Suspendisse vel egestas leo. Vestibulum faucibus vestibulum felis at interdum. Cras vestibulum, augue quis convallis laoreet, ligula est suscipit turpis, a sodales nunc orci vitae risus. Nam eu tristique dolor. Vivamus nec aliquam neque. Integer magna eros, mattis non cursus ut, hendrerit eu orci. Morbi eu felis metus. Vivamus eu malesuada tortor. Vivamus eget lectus sit amet magna mattis adipiscing eu non magna. Praesent pretium tincidunt enim vel consectetur. Sed dictum vestibulum ligula, non dictum quam vulputate quis. Aliquam erat volutpat. Maecenas iaculis pharetra iaculis.</p> </div> </body> </html> My code is here and it works ... However, I would like my dynamic table to show on the same page as my body and not on a new blank page. I have created a DIV and try playing around with the document.getElementById('monTab').innerHTML but it's not working out for me ... What am i missing ? Regards, Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>new Script - Javascript Cours 11</TITLE> <META content="text/html"; charset="UTF-8" http-equiv="content-type"> <SCRIPT type="text/javascript"> function createTable(){ var Etudiant = new Array(Number(prompt("How many Students will you put in ?",""))); document.write("<table border=\"1\">"); for (var i=0; i<Etudiant.length; i++) { Etudiant[i] = window.prompt("S'il vous plait entrez le nom d'un etudiant " + (i+1) + ".","") alert("Nice to see you "+Etudiant[i]); document.write("<td>"+Etudiant[i]+"</td>"); j = parseInt(prompt("Combien de notes voulez vous calculez ?")); for (h=0;h<j;h++){ notes[h] = parseInt(prompt("S'il vous plait entrez la "+(h+1)+" note de "+Etudiant[i])); document.write("<td>"+notes[h]+"</td>"); } document.write("<tr>"); } document.write("</tr>"); document.write("</table>"); document.getElementById('monTab').innerHTML=Etudiant; } </script> <BODY> <H1>Combien de note voulez vous cumulez ?</H1> <br> <br> <input type="button" name="btnSubmit" value="TRY IT" onclick="createTable()"> <div id="monTab" size="10"> Content should come here ...Content should come here ...Content should come here ...Content should come here ...Content should come here ...Content should come here ...Content should come here ... </div> </BODY> </HTML> I found this line in one of the scripts on javascript.kit <code> if(document.layers|| document.getElementById|| document.all) </code> Could someone give me an idea on why this line would be used in a code? Thank you very much I'm working on a website that will basically embed a widget/frame sent by a handler into a user's current page. The user basically adds a script tag to where they would like the HTML to be. The script tag has their settings and is basically a document.write that calls all the code that we want displayed. So here's my problem. We have a map that we need to add in a specific section, and to get the map we have to call another script tag. So we end up having a script tag (map) embedded in another script tag (the code for the widget/frame) or we end up having to document.write inside a document.write. Now this works just fine and as expected in Firefox, Safari, and Chrome. However, Internet Explorer and Opera wait until the first document.write is completely finished before calling the embedded one. Of course the problem with this, is that it takes the map out of the document's flow and just appends it to the bottom left of the page. Since the rest of the page has already been called, there's no way to move the interior "map" script. Any ideas? Basically just trying to figure out how (if even possible) to render an embedded script tag in Internet Explorer and be able to place it properly. I've tried everything that I can think of, including AJAX and Google's unescape script. Any suggestions, I'd greatly appreciate it. Or even if you've encountered a similar problem, and know that it just isn't possible in IE or Opera, that would be fine too. Thanks in advance! hi guys, how can i get this code to load on body onload? without fading in and out? Code: <html> <head> <!-- For ease i'm just using a JQuery version hosted by JQuery- you can download any version and link to it locally --> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function() { $("#responsecontainer").load("response.php"); var refreshId = setInterval(function() { $("#responsecontainer").load('response.php?randval='+ Math.random()); }, 9000); $.ajaxSetup({ cache: false }); }); </script> </head> <body> <div id="responsecontainer"> </div> </body> Thanks Hello, How can i get scroll bar position of body tag ? Thanks in advance. i had to put to onload commands in a body tag and now only one will work. is there any way to make both work?
this: Code: <body onload="pack = 'Original';recoger_mapa_url();" onkeydown="pulsar_tecla(event, 'onkeypress');" onkeypress="pulsar_tecla(event, 'onkeydown');"> [/CODE] to this: Code: pack = 'Original'; recoger_mapa_url(); window.onkeydown = pulsar_tecla(window.event, 'onkeypress'); window.onkeypress= pulsar_tecla(window.event, 'onkeydown'); does not work(event is undefined). Suggestions ? |