Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7835917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:52:39+00:00 2026-06-02T13:52:39+00:00

EDIT I was wondering how I can complete the href from my anchor tag

  • 0

EDIT

I was wondering how I can complete the href from my anchor tag with Javascript.
I have the following function which gives back my longitude and latitude.

   function(obj){
    if(navigator.geolocation){
        navigator.geolocation.getCurrentPosition(userPosition,errorPosition);
    }else {
        alert('Geolocation is not available');
    }
    function userPosition(position){
        obj.setAttribute('href', 'http://maps.google.com/maps?  daddr=~ITEM.STREET~,+~ITEM.CITY~&saddr=' + position.coords.latitude +  ',' position.coords.longitude);  
    }
    function errorPosition(error){
        switch(error.code){
            case eror.PERMISSION_DENIED:
                alert('permission denied');
                break;
        }
    }
}

Here I get the my current location his latitude and longitude as an alert.
But what I want to do is the following. At the moment I have this.

  <a class=localization href="#" onclick="geo(this)">
                <img src="images/localizationIcon.png" width=35 height=45 />
            </a>

I want that when I click on the image. The longitude and latitude is filled in in my href.

Can somebody help me?

Kind regards.

Stef

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:52:41+00:00Added an answer on June 2, 2026 at 1:52 pm

    Change onclick="geo()" to onclick="geo(this)"

    Change function geo() to function geo(obj)

    replace userPosition’s alert with:

    obj.setAttribute('href', 'http://maps.google.com/maps?  daddr=~ITEM.STREET~,+~ITEM.CITY~&saddr=' + position.coords.latitude +  ',' + position.coords.longitude);
    

    You will have to adjust this to match Google maps format. I’m not sure what they want the address in, but I’m pretty sure you are specifying a street address in this case, not a lat/longitude combination..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am wondering how can i have simple versioning, say i want to be
Hey guys, I'm wondering can someone help me out. I'm using javascript to serialize
I was wondering how can I match two digits but which are not the
i have a calendar formed table. and i was wondering how can i disable
I was wondering whether someone can shed some light on the following issue: We've
I was wondering if its ok to edit the created_at value of a record
I was wondering how programmers chose to edit XAML. Most of the programmers I
I'm wondering if there is a good example of how to edit ASP.NET Profile
Edit: Translated I have a RSS-feed that i want to parse. It's a podcast
EDIT How to simplify the following code: if(x(a) > x(b)) s = b; e

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.