RobCon
RobCon

Reputation: 75

how to make a link click to stay on same page

I have the following code:

<area href="/?22" shape="poly" coords="438,388,561,211">
<area href="/?23" shape="poly" coords="338,43,61,21">

when it's clicked the link send the "signal" and working fine, but the page change to:

http://192.168.0.177/?22 

or

http://192.168.0.177/?23 

and I want to keep the page to:

http://192.168.0.177

it's there a way/hack to click the link to send the signal but the page remain and of course to not refresh?

Thank you so much!

Upvotes: 3

Views: 28768

Answers (2)

mplungjan
mplungjan

Reputation: 177965

If you have no need for the href, return false onclick or use a JavaScript href:

<area href="/?22" onclick="return false" shape="poly" coords="438,388,561,211">

<area href="javascript:void(0)" shape="poly" coords="338,43,61,21">

If you DO need to load the href, use Ajax or add a named iframe and target it:

<area href="/?22" target="Iframe" shape="poly" coords="438,388,561,211">

...

<iframe name="Iframe" style="display:none"></iframe>

Upvotes: 7

Vetrivel
Vetrivel

Reputation: 306

How about adding onclick attribute as follows.

<area href="/?23" shape="poly" coords="338,43,61,21" onclick="return false;">

Upvotes: 1

Related Questions