user3586248
user3586248

Reputation: 163

A HREF URL won't work

I am trying to get the following link to work.

<a href='#' onclick='window.open(" | &ESPP_Info_URL | ");return false;'>Employee Stock Purchase Plan Information</a>

Basically the &ESPP_Info_URL variable takes in a url so that the code below looks like...

<a onclick="window.open(https://...);return false;" href="#">Employee Stock Purchase Plan Information</a>

But when I click the url it just refreshes the page. Does anyone know how to get this to access the link within the window.open function?

Upvotes: 0

Views: 127

Answers (2)

comixninja
comixninja

Reputation: 746

Here's an extended version with more dynamic functionality, jic: http://jsfiddle.net/ofnh7gke/

And the smaller version: http://jsfiddle.net/rqf3s72n/

Javascript

var sites = ['http://www.google.com','http://www.github.com'];
document.getElementById('btnStockPurchasePlan').onclick = function(){
    window.open(sites[0],'_parent');
    return false;
};

HTML

<a href='#' id="btnStockPurchasePlan">Employee Stock Purchase Plan Information</a>

Upvotes: 0

Krish R
Krish R

Reputation: 22711

Try this, You need wrap url with in single quotes ' - window.open('YOUR URL HERE')

<a onclick="window.open('YOUR URL HERE');return false;" href="#">Employee Stock Purchase Plan Information</a>

Upvotes: 1

Related Questions