SEARCH YOUR SOLUTION HERE  

keycodes and button actions

My buttons for Next page and Previous page are created in Javascript and images (in Saba Publisher). I need to make them keyboard accessible by using the keycodes for left arrow key (previous page) and right arrow key (next page)--right now alt-left and alt-right do not work.
I have some code that might work, but it doesn't:

document.onkeyup = KeyCheck; function KeyCheck(e) { var KeyID = (window.event) event.keyCode : e.keyCode; switch(KeyID) { case 36: window.location.href="/"; break; case 37: if (document.getElementById('prev').childNodes[0]) { window.location.href = document.getElementById('prev').childNodes[0].getAttribute('href'); } break; case 39: if (document.getElementById('next').childNodes[0]) { window.location.href = document.getElementById('next').childNodes[0].getAttribute('href'); } break; } } this.onkeyup = function(e) { var t = this; var v = t.findShortcut(e); if (v != null && v != false) { v.func.call(t); return false; } return true; }; this.onkeydown = function(e) { var t = this; var v = t.findShortcut(e); if (v != null && v != false) { return false; } return true; }; this.onkeypress = function(e) { var t = this; var v = t.findShortcut(e); if (v != null && v != false) { return false; } return true; };



Below is some of the code from my file:

function init12() { if( window.name.indexOf( 'Trivantis_' ) == -1 ) AICC_Lesson_Location.set( 'a001_what_is_coop_why_coop_.html' ) setTimeout( "preload( 'images/topbar.gif','images/bkgnd.gif','images/backoff.gif','images/backclk.gif','images/backrol.gif','images/homeoff.gif','images/homeclk.gif','images/homerol.gif','images/nextoff.gif','images/nextclk.gif','images/nextrol.gif','images/nih_logo_whitea.gif','images/coo_logo_04.jpg','images/whitearrow.gif','images/greencheck.gif','images/orslogoa.gif','images/help.gif','images/exit.gif' )", 0 ) button50869.init() button50871.init() text474.init() text467.init() image48600.init() button74.init() button76.init() button78.init() text42733.init() text48010.init() button74.activate() button76.activate() button78.activate() var trivGoToPage = null var trivCompleteCnt = 1; var hasProcessedExitActions = false; var trivGoToPage = null var trivCompleteCnt = 1; var hasProcessedExitActions = false; var trivWndFeedback = null; var trivWndImmFeedback = null; var currFeedbackIdx = 0; var trivPageExited = false; function trivExitPage( newPage, bFeedback ) { if( newPage.indexOf( "ObjLayerAction" ) >= 0 || newPage.indexOf( ".action" ) >= 0 || newPage.indexOf( "history.back()" ) >= 0) trivGoToPage = newPage else trivGoToPage = 'ObjLayerActionGoTo("' + newPage + '")' if( !hasProcessedExitActions ) { findWH() hasProcessedExitActions = true setTimeout( 'checkLeavePage()', 100) } } function trivLeavePage() { trivCompleteCnt-- if( trivCompleteCnt

Posted On: Monday 26th of November 2012 10:12:56 PM Total Views:  394
View Complete with Replies




Related Messages:

Radio button and textbox   (126 Views)
hi.can anyone give some suggestion on this I need to do for a system that calculate the marks. At first, I had created the radio buttons and textboxes for user to insert the marks, but it seems not so user friendly. So I decide to change them into automatically calculate the marks which means that when the user select the radio button, the system will automatically calculate and display the marks in the textbox. For example, maximum marks for question 1 is 5 and rating=1,2,3,4,5 (radio button) and user select 1, therefore the textbox will display value 1.But, for example, when the maximum marks for question 1 is 10 and rating=1,2,3,4,5 (radio button) and user select 3, I believe that most of the people will code the system to calculate and display at textbox witht the value 6. But in manual the marks can be 5 or 6. Therefore, is there any appropriate ways to do thisor any kinds of suggestion or comments which is more suitable to solve this problem are appreciated
Expand-Contract Javascript with button   (90 Views)
Hi everybody, I have this expand/contract thing, whereby a button is situated below a label "Advanced Features". And so when the user clicks on "Advanced Features", the button will drop below the whole expansion. The button should be situated BEFORE the label before clicking onto "Advanced Features". Any ideas on how I can do this var collapsable_parent_name = "collapseExpand"; var collapsable_parent_type = "div"; var collapsable_child_type = "div"; var collapsable_expand = "Advanced Features"; var collapsable_shrink = "Simple Features"; init = function() { if(document.getElementById && document.createTextNode) { var entries = document.getElementsByTagName(collapsable_parent_type); for(i = 0; i < entries.length; i++) if (entries[i].className == collapsable_parent_name) assignCollapse(entries[i]); } } assignCollapse = function (div) { var button = document.createElement("collapse_add_adv_features"); button.style.cursor = "pointer"; button.setAttribute("expand", collapsable_expand); button.setAttribute("shrink", collapsable_shrink); button.setAttribute("state", -1); div.insertBefore(button, div.getElementsByTagName(collapsable_child_type)[0]); button.onclick=function() { var state = -(1*this.getAttribute("state")); this.setAttribute("state", state); this.parentNode.getElementsByTagName(collapsable_child_type)[0].style.display=state==1'none':'block'; this.innerHTML = this.getAttribute(state==1"expand":"shrink"); }; button.onclick(); } window.onload = init; *First Name: *Last Name: 1 2 3 var switchMBTabs=new ddtabcontent("mailboxTabs") switchMBTabs.setpersist(true) switchMBTabs.setselectedClassTarget("link") //"link" or "linkparent" switchMBTabs.init()
Show price in field when radio button or checkbox?   (178 Views)
On first look this appears to be exactly what I was hopting for. I will work on taking this and plugging it into the registration page and expanding the functionality to the otherradio buttons. What would need to be done to add back in the ability to total up all of the prices in the regTotal field so that it shows a total and updates as radio buttons or checkboxes are clicked
radio button looses the selected state after validation   (164 Views)
I got a form page with 3 radio buttons. Radio button ,say A,B,C. billing and shipping address is what the form page consists of . Onclikc of A the user selects hide shipping address. On click of b , copy billing to shipping address as well and on click of C, user would type in a diff shipping address... works fine.but when i submit the form, and if form not complete, the after validation forms gets all the value but do not retain the selected radio button and the shipping form elements disabled or hidden status.. How could i tackle this issue
problem in checking focus of radio button   (179 Views)
I have 3 radio buttons which are in the radio button group. On tab change it has to focus on next radio button. I have written a function to do that, but Its going from first to second radio button, after that again its coming back to first radio button and repeating the same. Any one of you please help me in findingout on which radio button the focus is on presently... Here is the function, conversion is radio button function onTab(event) { var str=document.getElementById("conver").value; if(event.keyCode == 9 ) { for(i =0;i
Disabling back button in asp.net   (111 Views)
Hi , can any one tell me how to disable the back button in asp.net i have done like this but no use...is there any other way to do this., If a web page takes control of my browser, I will not be back.
How to retain the disable state of the button after?   (121 Views)
Hi Experts here, Pls help. when I disable the button using the code document.getElementById("mybutton").disable=true; it is disabling perfectly but when the page gets refreshed again it comes to enable position so, I need a code even when the refreshing the page also my button is in disable position.
Print button using rollover images   (227 Views)
Hi , First post here - so high hopes! I have created a rollover button that I want to use as a print button in DW MX but when I add Javascript print button code it doesn't work on my rollover. Can it be made to work or is it not possible In its single image state it works fine. Help please...
how do i make an x-button with which user can close a ele   (164 Views)
I couldn't even find the name for the "x-button" which usually is a window-closing button (or is it a button) I need such a button for user to delete/hide a element. How do I do that
how to apply JavaScript validation on radio buttons   (139 Views)
how can i write Javascript function to validate the radio button control , if a user have not selected the option for human and try to submit the form , then javascript function should promote user to enter his/her gender .i am pasting just the related fields of form. i just need the Javascript function which should validate this first
how to enable button when dropdown option is selected   (236 Views)
how to enable a button when dropdown option is selected in javascript ---select--- Show memory trends Show Thread count trend Show CPU trend button will be in disabled by default but when i select any option from dropdown list button(analyselogfile1)should be enable.how to do this.please reply me
It is allowing me to select more buttons than I should do   (243 Views)
Please follow these steps in the jsfiddle 1. Click on open grid link and select option "3", buttons A,B and C would appear 2. Enter in number 2 in the number of Answers textbox. Then select buttons A and C 3. Now click on the open grid again and select option 6. 4. Now the number of Answers textbox is empty so type in 2 again in the text-box. So only 2 answers should be selected which is A and C. So if you click on another button the alert message should appear stating you are beyond limit, deselect another button. But this does not happen. Instead the user can select another 2 buttons and then the alert message would appear if another button is selected. This means that 4 buttons are selected which is incorrect, it should still be 2. So does anyone have an idea why it is doing this
Trouble with ajax jquery validation submital radio buttons   (221 Views)
I was making a survey and it was working fine with the jquery validate I was getting the right variables but when I added the ajax submit function now i only get the first radio as the value. What kind of beer did you have this weekend Domestic Import Craftbeer or Microbrew Cheapest I could find of the above ajax function $(document).ready(function(){ $("form#commentForm").submit(function() { // we want to store the values from the form input box, then send via ajax below var beerKind = $('#beerKind').attr('value'); var beerPlace = $('#beerPlace').attr('value'); var beerType = $('#beerType').attr('value'); var state = $('#state').attr('value'); var sex = $('#sex').attr('value'); $.ajax({ type: "POST", url: "actionSurvey.php", data: "beerKind="+ beerKind +"& beerPlace="+ beerPlace +"& beerType="+ beerType +"& state="+ state +"& sex="+ sex, success: function(){ $('form#commentForm').hide(function(){$('div.success').fadeIn();}); } }); return false; }); }); any help greatly appreciated
question:how can i call a php file after submit button(in form)   (180 Views)
function validform(){ var x=document.forms["form3"]["name"].value; var y=document.forms["form3"]["f_name"].value; var z=document.forms["form3"]["email"].value; var atpos=z.indexOf("@"); var dotpos=z.lastIndexOf("."); if(x==null || x=='') { alert("your name is missing"); return false; } else if (y==null || y=='') { alert("your father name is missing"); return false; } else if (atpos
Unique values from group of radio buttons   (132 Views)
I am working on survey application in this I want only unique answers to be selected like for eg Question 1 4 3 2 1 Question 2 4 3 2 1 Question 3 4 3 2 1 Question 4 4 3 2 1 on submit I want to check for 2 things - all the questions are to be answered - the values selected for each should be unique like for question 1 if user has select 4 then for question 2, 3 & 4 the 4th option should be disabled. I worked out something like this in javascript : $(document).ready(function() { $('input:radio').click(function() { //reset all the radios $('input:radio').removeAttr('disabled'); if($(this).is(':checked')) { var val = $(this).val(); //disable all the ones with the same value $('input:radio').each(function() { if(val == $(this).val()) { $(this).attr('disabled',true); } }); //let's not disable the one we have just clicked on $(this).removeAttr('disabled'); } }); }); function check() { for(var i=1;i
Javascript button not working   (139 Views)
I've got a photo gallery button on my website. I've got one button that looks like a forward arrow, which works fine and a back arrow, which does nothing. Also clicking on the thumbnail to view a larger one works fine. Everything is fine except for the back arrow. Here is some code below: function prevPic(){ imgNum = imgNum - 1; if(imgNum=6){ imgNum = 0; groupNum = groupNum + 1; } switch(imgNum){ case 1: document.getElementById("full").src="images/tanks2.jpeg"; document.getElementById("bar1").src="images/bar2.jpg"; document.getElementById("bar2").src="images/bar.jpg"; document.getElementById("bar3").src="images/bar2.jpg"; document.getElementById("bar4").src="images/bar2.jpg"; document.getElementById("bar5").src="images/bar2.jpg"; document.getElementById("bar6").src="images/bar2.jpg"; break; case 2: document.getElementById("full").src="images/house1.jpeg"; document.getElementById("bar1").src="images/bar2.jpg"; document.getElementById("bar2").src="images/bar2.jpg"; document.getElementById("bar3").src="images/bar.jpg"; document.getElementById("bar4").src="images/bar2.jpg"; document.getElementById("bar5").src="images/bar2.jpg"; document.getElementById("bar6").src="images/bar2.jpg"; break; case 3: document.getElementById("full").src="images/house2.jpeg"; document.getElementById("bar1").src="images/bar2.jpg"; document.getElementById("bar2").src="images/bar2.jpg"; document.getElementById("bar3").src="images/bar2.jpg"; document.getElementById("bar4").src="images/bar.jpg"; document.getElementById("bar5").src="images/bar2.jpg"; document.getElementById("bar6").src="images/bar2.jpg"; break; case 4: document.getElementById("full").src="images/platform1.jpeg"; document.getElementById("bar1").src="images/bar2.jpg"; document.getElementById("bar2").src="images/bar2.jpg"; document.getElementById("bar3").src="images/bar2.jpg"; document.getElementById("bar4").src="images/bar2.jpg"; document.getElementById("bar5").src="images/bar.jpg"; document.getElementById("bar6").src="images/bar2.jpg"; break; case 5: document.getElementById("full").src="images/platform2.jpeg"; document.getElementById("bar1").src="images/bar2.jpg"; document.getElementById("bar2").src="images/bar2.jpg"; document.getElementById("bar3").src="images/bar2.jpg"; document.getElementById("bar4").src="images/bar2.jpg"; document.getElementById("bar5").src="images/bar2.jpg"; document.getElementById("bar6").src="images/bar.jpg"; break; } } function prevPic(){ imgNum = imgNum - 1; if(imgNum
Adding next and previous buttons to Jquery SlideViewer   (130 Views)
Good afternoon, I have used Jquery slideviewer 1.2 (http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html) to create this gallery http://www.domus.net/tour as you can see I have customised it in appearance somewhat however being a bit of a novice with ammending the actual script (working on my javascript skills!) I cannot get a next and previous button to work on it. If you click the left, or right hand side of the image you will see it automatically slides either way, so the action must already be there somewhere, all I simply want to do is add a previous button overlayed on the left of the image, and same with the next on the right, has anyone got an example of this in use or able to show me what I need to add to the script and buttons to get this working I would prefer to keep the same script and appearance so any help would be massively appreciated,
functions with radio buttons   (193 Views)
What is the equivalent for radio buttons radio.checked if (document.Shipping.checkbox.checked)
Managing browser history inside Iframe with back button   (162 Views)
Good day : I was wondering if anyone have had experience dealing with the browser history inside an Iframe. Specifically, how to navigate with the back button throught the history inside the Iframe ONLY, and not the entire page. I have an Iframe that is called inside my page like so: $(document).ready(main); function main() { $('iframe').attr('src', getIframeUrl() ); registerEvents(); resizeIframe(); } function getIframeUrl() { var url = window.location.href; var iframe_url = 'http://samplepage.com'; var param_start = url.indexOf("iframe="); if( param_start != -1 ) iframe_url = url.substr(param_start+7,url.length-param_start-7); if( iframe_url.indexOf("http://") == -1) iframe_url = "http://" + iframe_url; return iframe_url; } and inside my html I have embedded a back button inside the iframe, like so: and I have tried any number of suggestions for the onclick event with not much success. I have tested the following: onClick="directory.history.back()"//directory being the name of the iframe onClick="iFrame.contentWindow.history.back()" May I ask for some help Thank you, Mossa
functions with radio buttons   (220 Views)
What is the equivalent for radio buttons radio.checked if (document.Shipping.checkbox.checked)