Right click and get "copy link address" on javascript redirect


So here's my situation, I have a div that is clickable and redirects to a page using the window.location.href method. I'm not using anchor tags because within the div, there are other links that can be clicked. So I'm using the onclick redirect for the div, then using stopPropagation to prevent the redirect when links are clicked.

The problem is, I would like the javascript redirect to also work like a link. So that when you right click it, you are given the option to copy the link address, as this is significantly more convenient for myself and my users, rather than having to click it first and then copy the URL. Does anyone know how this can be accomplished
This post has been edited by itdoell: 30 November 2011 - 04:07 PM
Posted On: Sunday 23rd of December 2012 10:50:11 PM Total Views:  203
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Dynamic drop down dependent on text box input in JSP

I am required to create a Login Page with Username, Password and Deparment drop down box in JSP. The Primary requirement is that the drop down gets populated(depending on username & password values) after i enter details into username and password fields. Please help me with a way to capture this username and password and query it to the DB without submitting the login form.I could not find a value change listener method for JSP (I know how to make it work using JSF).
VIEWS ON THIS POST

89

Posted on:

Saturday 10th November 2012
View Replies!

Ajax Code not Working :(

, I am building my own playlist. When the user selects a movie to be played, I use an XML Request to load the movie in place. However, the player vanishes, when it is suppose to be loaded. I basically call this javascript upon clicking the movie function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } var movieRequest; var link; function loadMovie(show,season,episode) { movieRequest = GetXmlHttpObject(); link = "http://connect2web.info/getMovie.phpshow="+show+"&season="+season+"&episode="+episode; movieRequest.onreadystatechange = getMovie; movieRequest.open("GET",link,true); movieRequest.send(null); } function getMovie() { if( movieRequest.readyState == 4 ) { document.getElementById('player').innerHTML = movieRequest.responseText; } } And this is the PHP file var playerVar = new SWFObject('http://connect2web.info/stream/player.swf','player','512','384','10'); playerVar.addParam('allowfullscreen','true'); playerVar.addParam('allowscriptaccess','always'); playerVar.addVariable('file',''); playerVar.addVariable('skin', 'http://connect2web.info/stream/bluemetal.swf'); playerVar.write('preview'); What is wrong
VIEWS ON THIS POST

43

Posted on:

Saturday 10th November 2012
View Replies!

JavaScript Error "Uncaught TypeError: Object?

I just got this script for a countdown on a website and I got it to work locally but when I upload it to the server i get the error "index.html:22 Uncaught TypeError: Object [object Object] has no method 'fancycountdown'". I have checked to make sure all other javascript files are loading and they are and I can't figure out whats wrong. You can see it here: http://con.fwusy.net/countdown/index.html Anybody know what to do
VIEWS ON THIS POST

44

Posted on:

Saturday 10th November 2012
View Replies!

change file input value in javascript

Does anyone know if i can write a generic javascript function that check the file extension of the uploaded files and if the extension is incorrect erases the value because the user upload's more then one file i want to get the ID from the form something like: fileselectedchange(obj) { var fileEXT = obj.substring(obj.indexOf('.')+1, obj.length); if (fileEXT.toUpperCase() != 'XLS'){ alert('Please Select Only XLS File'); /* erasing the file input text geting the name from "obj" */ /* something like document.getelemntbyname(obj.name).value = "";*/ return; } } sorry if my english is not the best
VIEWS ON THIS POST

77

Posted on:

Saturday 10th November 2012
View Replies!

javaScript-problem passing value from javascript of?

Hi , i'm doing my FYP, and facing the following problem. below is my code for the javaScript function deleteAccount(ckId){ alert(ckId); var index = document.getElementById(ckId).value; document.getElementById('hiddenind').value = index; var conf = confirm("Are you sure you want to permanently remove this account"); if(conf == true) { document.form.action = "/AccServlettranx=deleteAccount&empId=]"; document.form.submit(); } else return; } then inside the form I have test that the data can be pass to javascript using alert(ckId);. However the data can't be pass to this line in javascript: document.form.action = "/AccServlettranx=deleteAccount&empId= The '' at the end of the line suppose to get the value of ckId and pass to servlet. However no matter how i try , thing i write to replace the '' symbol is pass to servlet only, not its value. ======================================================== Below is the code inside the servlet: if (request.getParameter("tranx").equalsIgnoreCase("deleteAccount")){ url="/Acc/DeleteAcc.jsp"; request.getParameter(empId); System.out.println("Test empId value: "+empId); accBean.deleteAcc(empId); dispatcher = getServletContext().getRequestDispatcher(url); dispatcher.forward(request, response); return; }
VIEWS ON THIS POST

164

Posted on:

Saturday 10th November 2012
View Replies!

problem with animation of text [Raphael]

So I need to show a piece of text on the hover event but the text only gets shown the first time I rollover the area after that I get an error: this.parentNode is null. I am using Raphael to draw my graphics and I need a circle to appear with a short textual description on that circle when the user rolls overs the different arcs of the main circle. You can run the code and see what is happening. It only shows the first textual desc. and not the subsequent ones. Any help/suggestions are much appreciated. Attached are the .html and .css files below is the javascript. You need raphael.js too. https://raw.github.c.../raphael-min.js var o = { init: function(){ this.diagram(); }, random: function(l, u){ return Math.floor((Math.random()*(u-l+1))+l); }, diagram: function(){ //set the size of the canvas to dra in var r = Raphael('diagram', 1000, 1000), rad = 73, //radius defaultText = 'Ecological'+ '\n' + 'Approach' + '\n' + 'Navigator', speed = 150; //speed of the animation //draw the inner circle (x,y,radius); set the fill and the stroke r.circle(300, 300, 85).attr({ stroke: 'none', fill: '#399977' }); //draw the smaller circle that will contain the textual descriptions when the user hovers //over the arcs of the circle var c = Raphael('desc', 300, 300); //initially we want to hide the circle $('#desc').hide(); //set up the variable to hold the text and set the attr. for the text var desc = c.text(100, 100, 'Some Text').attr({ font: '10px Arial', fill: '#333' }).toFront(); //set up the variable to hold the text and set the attr. for the text var title = r.text(300, 300, defaultText).attr({ font: '20px Arial', fill: '#fff' }).toFront(); //here we set the values for the arcs //sx,sy is where the arc begins to be drawn on the path //x,y is where the drawing of the arch ends r.customAttributes.arc = function(value, color, rad){ var v = 3.6*value, alpha = v == 360 359.99 : v, random = o.random(200, 201), a = (random-359.99) * Math.PI/180, b = random * Math.PI/180, sx = 300 + rad * Math.cos(B), sy = 300 - rad * Math.sin(B), x = 300 + rad * Math.cos(a), y = 300 - rad * Math.sin(a), path = [['M', sx, sy], ['A', rad, rad, 0, +(alpha > 180), 1, x, y]]; return { path: path, stroke: color } } //this sets the color, value, and text to display inside of the innermost circle //these values come from the html file $('.get').find('.arc').each(function(i){ var t = $(this), color = t.find('.color').val(), value = t.find('.percent').val(), text = t.find('.text').text(), text_desc = t.find('.text_desc').text(); //here we increase the radius by 30 rad += 30; var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': 26 }); z.mouseover(function(){ this.animate({ 'stroke-width': 42, opacity: .85 }, 1000, 'elastic'); if(Raphael.type != 'VML') //solves IE problem this.toFront(); title.stop().animate({ opacity: 0 }, speed, '>', function(){ this.attr({ text: text}).animate({ opacity: 1 }, speed, '', function(){ title.attr({ text: defaultText}).animate({ opacity: 1 }, speed, '', function(){ desc.toFront().attr({ text: text_desc}).animate({ opacity: 1 }, speed, '
VIEWS ON THIS POST

109

Posted on:

Monday 12th November 2012
View Replies!

Factoring quadratic equation (not solving)

How would i factor out a quadratic equation so that this happened using javascript ax^2+bx+c i want to factor this to (qx + n)(gx + v) where q n g and v are named at random I know how to get the zeros or solutions, but I want to find the factored form itself. Any ideas
VIEWS ON THIS POST

48

Posted on:

Monday 12th November 2012
View Replies!

why those two functions dont work under one button but work ok withTWO

Hi have these checkout page where have billing address fields and credit card fields there are two different scripts to check both billing address and credit card fields but the functions just dont work when try to call them up with one button if I use two buttons both functions do their job but on one form I want have one button... will appreciate if you help me with these! CHECKOUT .greetext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;color: #006600;} .blacktext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;color: #000000;} .checkout {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} .checkoutinput {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} .nopcart {background: #464444;border: 1px;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #ffffff;} .nopheader {background: #464444;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #FFFFFF;} .nopentry {background: #FFFFFF;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} .noptotal {background: #FFFFFF;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} .nopbutton {background: #FFFFFF;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} var ccErrorNo = 0; var ccErrors = new Array () ccErrors [0] = "Unknown card type"; ccErrors [1] = "No card number provided"; ccErrors [2] = "Credit card number is in invalid format"; ccErrors [3] = "Credit card number is invalid"; ccErrors [4] = "Credit card number has an inappropriate number of digits"; function allcheck() { if (testCreditCard ()){ if (expiredate()){ alert(" Your order has been placed"); return true } } return false } function testCreditCard () { myCardNo = document.getElementById('CardNumber').value; myCardType = document.getElementById('CardType').value; if (checkCreditCard (myCardNo,myCardType)) { return true } else {alert (ccErrors[ccErrorNo])}; return false } function checkCreditCard (cardnumber, cardname) { // Array to hold the permitted card characteristics var cards = new Array(); // Define the cards we support. You may add addtional card types as follows. // Name: As in the selection box of the form - must be same as user's // Length: List of possible valid lengths of the card number for the card // prefixes: List of possible prefixes for the card // checkdigit: Boolean to say whether there is a check digit cards [0] = {name: "Visa", length: "13,16", prefixes: "4", checkdigit: true}; cards [1] = {name: "MasterCard", length: "16", prefixes: "51,52,53,54,55", checkdigit: true}; cards [2] = {name: "VisaElectron", length: "16", prefixes: "4026,417500,4508,4844,4913,4917", checkdigit: true}; cards [3] = {name: "LaserCard", length: "16,17,18,19", prefixes: "6304,6706,6771,6709", checkdigit: true}; // Establish card type var cardType = -1; for (var i=0; i= 0; i--) { // Extract the next digit and multiply by 1 or 2 on alternative digits. calc = Number(cardNo.charAt(i)) * j; // If the result is in two digits add 1 to the checksum total if (calc > 9) { checksum = checksum + 1; calc = calc - 10; } // Add the units element to the checksum total checksum = checksum + calc; // Switch the value of j if (j ==1) {j = 2} else {j = 1}; } // done - if checksum is divisible by 10, it is a valid modulus 10. // If not, report an error. if (checksum % 10 != 0) { ccErrorNo = 3; return false; } } // Check it's not a spam number if (cardNo == '5490997771092064') { ccErrorNo = 5; return false; } // The following are the card-specific checks we undertake. var LengthValid = false; var PrefixValid = false; var undefined; // We use these for holding the valid lengths and prefixes of a card type var prefix = new Array (); var lengths = new Array (); // Load an array with the valid prefixes for this card prefix = cards[cardType].prefixes.split(","); // Now see if any of them match what we have in the card number for (i=0; i
VIEWS ON THIS POST

166

Posted on:

Monday 12th November 2012
View Replies!

change alerts position

ok so a mate of mine tricked me onto one of those popup sites as a laugh so im making one to get him back however i dont just want normal popups. im wondering if its possible to change the location of an alert box lik you can do with a window box because then i could find the dimensions of a users screen size and then randomly place the alerts to make it even more annoying regards
VIEWS ON THIS POST

87

Posted on:

Monday 12th November 2012
View Replies!

sleep or delay not working in IE 7 on windows XP

I like to have a sleep or delay function in javascript. The Prototype library 1.6.1 has a delay function. It is working well in Firefox or Chrome but not IE 7 on windows XP. Please help (I cannot use newer version of windows). function sleep() { } sleep.delay(0.1);
VIEWS ON THIS POST

115

Posted on:

Friday 16th November 2012
View Replies!

useful failure-- for browser detect

My school assignment is to use browser detect to get the name and variation of a browser. I have been looking for detectible features, but the codes are way long. Document.all is good for seeing if this is explorer 4+, but what is a good thing for finding explorer 7 Explorer 8 What is a feature exclusive to Safari To Chrome to Firefox This seems really hard, as browsers seem to be trying to get more compliant, that means there is less variation to check on.
VIEWS ON THIS POST

153

Posted on:

Monday 19th November 2012
View Replies!

how i m putting java script in my blog

how i m putting java script in my blog which is in xml ,my java script code is like in between which tag i m puting this code my blog is in blooger.com and the code is for mouse crusor effect is blog support mouse crusor effect or not plz suggest me .....
VIEWS ON THIS POST

70

Posted on:

Monday 19th November 2012
View Replies!

Image Slideshow

please anyone help
VIEWS ON THIS POST

210

Posted on:

Wednesday 21st November 2012
View Replies!

Grid question

please check this URL http://demos.telerik.../defaultcs.aspx grid on above link is made in dotnet. i want to make same UI as in Java. which technologies should be used that can be easy to use with java. please suggest. thanks. please tell how i create the nested grid using GWT API's. This post has been edited by vijaykumardahiya: 21 July 2010 - 04:58 AM
VIEWS ON THIS POST

112

Posted on:

Wednesday 21st November 2012
View Replies!

Javascript table issues

I am trying to create a javascript table using the numbers 5-15 that squares and then cubes a number in a row. My result should look like this 5 25 125 6 36 216 7 49 343 8 64 512 9 81 729 10 100 1000 11 121 1331 goes all the way to 15 Here is what I have so far // alert("Table of Squares and Cubes from 5-15"); document.write(''); //loop for rows for (j=5;j
VIEWS ON THIS POST

83

Posted on:

Wednesday 21st November 2012
View Replies!

PGN Chess viewer

I am planning to write a code for an on-line pgn chess viewer! The idea is that user uploads his (.pgn) file to the system and else can see it. User or the loader will be able play back and forth in the game and at the bottom somewhere render some comment and/or some anlysis. The viewer(the program) will support only pgn (portable game notation) files. I need information about this file type and its usage too. Now the question! Where to start -- is there a free code without license restrictions that I can manipulate according to my plans etc...
VIEWS ON THIS POST

65

Posted on:

Wednesday 21st November 2012
View Replies!

javascript/php integration

could anyone please point me in the right direction for a good site or tutorials that explain how to intergrate php and javascript \t
VIEWS ON THIS POST

61

Posted on:

Wednesday 21st November 2012
View Replies!

AJAX PHP Form Problems

I only just recently started learning to use AJAX and working it with PHP, but anyway, the situation is that I have a form and I have it so when the submit button is clicked it runs a javascript which uses XMLHttpRequest to pass info off to a php script which works with the mySQL database to add all the new info. Sadly, every time I click the Submit button, the form does its fast disappear/reappear empty (which leads me to think at least something is happening) and the mySQL database isn't updated. The java script: function submit() { var xhr; try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xhr = new XMLHttpRequest(); xhr.overrideMimeType('text/xml'); } } var str = "id="+escape(bio.id.value)+"&height="+escape(bio.height.value)+"&weight="+escape(bio.weight.value)+"&age="+escape(bio.age.value)+"&bats="+escape(bio.bats.value)+"&throws="+escape(bio.throws.value)+"&fs="+escape(bio.f_sport.value)+"&ft="+escape(bio.f_team.value)+"&fb="+escape(bio.f_band.value)+"&fg="+escape(bio.f_genre.value)+"&fm="+escape(bio.f_movies.value)+"&body="+escape(bio.body.value)+"&user="+escape(bio.username.value)+"&password="+escape(bio.password.value); xhr.onreadystatechange = pChange; xhr.open("POST", "actions/team.php", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xhr.send(str); } function pChange() { if ( xhr.readyState == 4 ) { if ( xhr.status == 200 ) { document.getElementById("middle-content").innerHTML = xhr.responseText; } else { document.getElementById("middle-content").innerHTML = "Error code: " + xhr.status; } } } The PHP script:
VIEWS ON THIS POST

40

Posted on:

Wednesday 21st November 2012
View Replies!

Array prints out undefined elements

I have a small array which I will be printing out for email. The only thing that should be going into the array are the "Not OK" options that have been selected by the user, instead all the "Not OK" values are going into the array, and when the array is printed (documnet.write), the "Not OK" options that were not selected, show as 'undefined'. Here is the js: var elem = document.getElementsByTagName('select'); var comment = document.forms[0].comments.value; var str = ""; var NotOkArray = new Array; for (var i = 0; i < elem.length; i++) { if (elem[i].value == 'notOK') { NotOkArray[i] = elem[i].name; } } Here is a portion of the html: N/A Okay Needs Work Fixed by Inspector Fixed by Mechanic R. Headlight N/A Okay Needs Work Fixed by Inspector Fixed by Mechanic L.F. Turn N/A Okay Needs Work Fixed by Inspector Fixed by Mechanic I tried changing line 8 to: if (elem[i].value == 'notOK' && elem[i].text == 'Needs Work') But then nothing prints. Ideas This post has been edited by teahou: 18 May 2011 - 10:21 PM
VIEWS ON THIS POST

107

Posted on:

Thursday 22nd November 2012
View Replies!

SCRIPT ERROR

Good Morning, I have tried to run this script but keep getting errors. I'm supposed to click the submit button on the form and the information from the form is supposed to generate into a response page. Here is the code. Any help will greatly appreciated. HardWare FeedBack Form HardWare Supply Store Feedback Form What about us do you want to comment on How did you hear about our Web site Yahoo Commercial Magazine E-Mail Friend (Other) Contact Information   E-mail  Please enter me on your e-mail function displayJS() { var strComment, strSource, strName, strEmail, strEList; strComment = document.frmHardware.txtComment.value; strSource = document.frmHardware.1stSource.value; strName = document.frmHardware.txtName.value; strEmail = document.frmHardware.txtEmail.value; strEList = document.frmHardware.chkEList.value; Hardware Supply Store Form Results document.writeln("Thank you " + strName + for your comment"); document.writeln(""); document.writeln("Comment: " + strComment); document.writeln("E-mail Address: " + strEmail); document.writeln("Referred By: " + strSource); document.writeln("Sign-Up: " + strEList); }
VIEWS ON THIS POST

56

Posted on:

Friday 23rd November 2012
View Replies!

FAQ Maintainer - Bart?

Bart - Are you an FAQ Maintainer I've tried mailing you but it bounced. If you're an FAQ maintainer, please send me a mail so we can work together. Garrett...
VIEWS ON THIS POST

56

Posted on:

Saturday 24th November 2012
View Replies!

Jquery wont work? Or the code had the problem?

! I created a website. I tested it on my computer it works when I transfer it to the host it won't work now :( here's the code NeverlastingRO $(document).ready(function() { $('a#homeAnchor').click(function() { $('.fordownload,.forinformation,.fordonate').hide(); $('.forhome').show('slow'); }) $('a#downloadAnchor').click(function() { $('.forhome,.forinformation,.fordonate').hide(); $('.fordownload').show('slow'); }) $('a#informationAnchor').click(function() { $('.forhome,.fordownload,.fordonate').hide(); $('.forinformation,').show('slow'); }) $('a#donateAnchor').click(function() { $('.forhome,.forinformation,.fordownload').hide(); $('.fordonate').show('slow'); }) }); Then the code at the href's are here etc. THANKS ALOT FOR HELPING MEEEE..!!
VIEWS ON THIS POST

103

Posted on:

Saturday 24th November 2012
View Replies!

How to test / use Java Script

I'm learning JavaScript, and want to know how I can run / test code on windows I also want to download the library. Can anyone assist me
VIEWS ON THIS POST

139

Posted on:

Monday 26th November 2012
View Replies!

Having minor problem

am having a little problem i am trying to add some validations to this from i made the form using tables however its not being color coded and when submitted its not checking the appropriate validations any body can spear to look at it please. Book Information function check_bcode() { var bcode bcode=document.frbookinfo.txtbcode.value if(bcode=="") { alert("This field is compulsory") document.frabookinfo.txtbcode.focus() } // need more code for ICT starting with } function check_name() { var name,namlength name=document.frbookinfo.txtbname.value namlength=name.length if (namlength >=20) { alert("This field should be less than 20 characters") document.frbookinfo.txtbname.value="" document.frbookinfo.txtbname.focus() } } function check_conditions() { var versions,cat,month,date,isbn,t_price,gvt,n_price versions=document.frbookinfo.version.focus if(versions="") { alert("Please select a version") return false } var result,count result=true for(count=0;count4) { alert("Please enter a year less than four characters") document.frbookinfo.txtyear.value=="" document.frbookinfo.txtyear.focus return false } ////place is number here if(document.frbookinfo.txttotal
VIEWS ON THIS POST

89

Posted on:

Monday 26th November 2012
View Replies!

Binary to Decimal Converter

Converts binary numbers to their equivalent decimal numbers.
VIEWS ON THIS POST

44

Posted on:

Monday 26th November 2012
View Replies!

cookie on different domain

Is there anyway to set cookie on a different domain
VIEWS ON THIS POST

389

Posted on:

Friday 30th November 2012
View Replies!

APPLIED COMPUTING 2008 - Last Call for Papers

Apologies for cross-postings. Please send to interested colleagues and students Submission Deadline (second call): 28 January 2008 ************************************************************* IADIS INTERNATIONAL CONFERENCE APPLIED COMPUTING 2008 April 10-13, 2008 - ALGARVE, PORTUGAL ( http://www.computing- conf.org/) ************************************************************* * Keynote Speaker (confirmed): Marcin Paprzycki, ...
VIEWS ON THIS POST

66

Posted on:

Friday 30th November 2012
View Replies!

Convert tabular information to ASCII text

Does it possible with javascript represent tabular information as plain text Is there way to convert spreadsheets and tables to and from ASCII text Which can be used for email messages, source code comments and cross-platform documentation.
VIEWS ON THIS POST

42

Posted on:

Friday 30th November 2012
View Replies!

Confused about setTimeout function.

first things first, please take a second to check out the page on the link below. http://bookofjavascript.com/Chapter13/Assignment.html In this page, you are supposed to click on the "Make Happiness Bounce" button to make the smiley face start bouncing and ...
VIEWS ON THIS POST

207

Posted on:

Friday 30th November 2012
View Replies!

Printing a page

I need to hide some controls on the Web page (.aspx), print it, and then display the controls again. Is it possible Something like this (this does not work): function PrintForm() { document.getElementById("tblCtls").style.display="none"; window.print(); document.getElementById("tblCtls").style.display=""; } In this example, the ...
VIEWS ON THIS POST

68

Posted on:

Friday 30th November 2012
View Replies!