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 6351959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:06:39+00:00 2026-05-24T22:06:39+00:00

Say I have var mycircle = paper.circle(0, 0, 20).attr({stroke: #ff0000}); Now by default when

  • 0

Say I have var mycircle = paper.circle(0, 0, 20).attr({stroke: "#ff0000"});

Now by default when someone goes to my page at www.url.com/index.html they get this circle with the red stroke.

However, what if I wanted
the circle stroke to change if a #hash was defined when browsing, e.g.
a selection was made and you wanted to link it to someone. Say someone
browses to www.url.com/index.html#mycircle now.

With: var hash = window.location.hash.substr(1) I can make the variable hash return “mycircle”.

However, by doing
hash.attr({stroke: "#0000ff"}); the stroke colour wont change to blue! Is there a way around this so I could change the stroke of the circle like so?

// EDIT

I have set up my circles like so:

var name1 = paper.circle(....);
name1.node.id = "name1";
name1.node.name = "Name";

var name2 = paper.circle(....);
name2.node.id = "name2";
name2.node.name = "Another Name";

And so on. Then I have combined them into a set:

nodes = paper.set();
nodes.push(name1, name2, name3, name4....);

I then use nodes.hover(function() { }); and nodes.click(function() { }); to define actions. The name.node.id is used for loading the right info page into a div while the name.node.name appears above the node when the user hovers over it.

I tried reorganizing my nodes as suggested:

var mapObjects = {};

mapObjects['name1'] = paper.circle(....);
mapObjects['name1'].node.id = "name1";
mapObjects['name1'].node.name = "Name";

mapObjects['name2'] = paper.circle(....);
mapObjects['name2'].node.id = "name1";
mapObjects['name2'].node.name = "Another Name";

I then tried to use the functions like I did before by simply changing nodes into mapObjects mapObjects.hover(function() { }); same with click. These didn’t work anymore! The hash technique worked tho so that’s a step to the right direction. How do I get my hover and click functions working now?

  • 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-05-24T22:06:41+00:00Added an answer on May 24, 2026 at 10:06 pm

    The eval would help, but it would be very vulnerable. The better way is to remember the circle in associative array:

    var objects = {};
    objects['mycircle'] = paper.circle(0, 0, 20).attr({stroke: "#ff0000"});
    objects[hash].attr({stroke: "#0000ff"});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have: var url="http://www.google.html"; how do I put the URL variable value
Not sure how to ask this question, but here goes. Say I have: var
say i have a file /var/www/foo/test.php how do i find out it's path from
Let's say you have var funct=function(a,b){ return a+b; }; console.log(funct); Is there any way
Say I have the following : var a = $(#a); var b = $(#b);
Let's say I have this string var: string strData = 1|2|3|4||a|b|c|d Then, I make
Let's say I have an array var test = new Array() the values in
Say I have a StringBuilder object var sb = new StringBuilder(); And an arbritrary
Say I have the following JS: var foo_index = 123; var bar_index = 456;
Say I have a collection of bytes var bytes = new byte[] {0, 1,

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.