May 21, 2013

URL prevent href button action php

User222914’s Question:

Hi I have a href tag where I order an array values(up to down or down to up),so my problem is that when I click twice in the same button I have no action performed.That because of in my url I have something like that:
When I click for the 1st time on my button the action is done,but I click again on the same button nothing,but when I click ‘F5’ action the action is done:
Exemple in my URL when I click one time:

http://localhost/home/test.php?dir=down&keyword=1

The second time I click the URL remains the same but no action is done.it is done when I click on F5.

My hyperlink:

echo "<a href="$_SERVER[PHP_SELF]?dir=down&keyword=$keywordkey"><img src=web/images/remove.png /></a>";

How can I resolve this ?
Thank you!!!

After you click on the button for the first time, you give command to your script to sort it downwards.

Once this action is complete, you still have same command to provide to your script i.e. down

Since it is a same command going to the your code, is does exactly same thus, the results are also same.

May 5, 2012

have an html link direct someone to another page and pop up another page

Question by Kyle Supe

I have tried searching for an answer to this but my searches have come up empty handed. Its tough to even figure out what terms to search for. Basically what I have is a list of products. I have the functionality in place where you click the picture and it opens a new tab directing you to an external link where you can buy the product using target =_blank in my a href. I would also like the picture to direct to another internal link where you can comment on and rate the product and just open it in the same tab that the original page is on (so you would essentially have to hit back to return to the main product list. Is this possible to do and if so how?
Thanks in advance for any guidance.

Answer by Riateche

<a href="url for new tab" target="_blank" 
  onclick="location.href = 'url for current tab'">Link</a>

Answer by Starx

Its pretty simple, use an onclick handler combined with href tags.

<a href="#yourinternallink" onclick="window.open('popup.html')">
   <img src="link/to/my/image.jpg" />
</a>
April 17, 2012

drop down instead of a href

Question by Yarandi

i want change this input to dropdown menu.

<a href="#" onclick="$('#pb1').progressBar(5);">5</a> |
<a href="#" onclick="$('#pb1').progressBar(60);">60</a> |
<a href="#" onclick="$('#pb1').progressBar(100);">100</a>

dropdown sample…(not work)

<form action="#" name="progress" onclick="$('#pb1').progressBar(10);">
   <select name="dropdown">
    <option name="radOne" value="$('#pb1').progressBar(5);" selected>5</option>
    <option name="radOne" value="$('#pb1').progressBar(60);">60</option>
    <option name="radOne" value="$('#pb1').progressBar(100);">100</option>
   </select>
</form> 

can anyone help me about change this structure?

Answer by Starx

This is how you should do it.

   <select name="dropdown" onchange="$('#pb1').progressBar(this.value);">
    <option name="radOne" value="5" selected>5</option>
    <option name="radOne" value="60">60</option>
    <option name="radOne" value="100">100</option>
   </select>

Even like show, the practice of inline event handlers is not encouraged. Better approach is

document.getElementByid("selectboxid").onchange = function() {
    $('#pb1').progressBar(this.value);
};

But, since you are already using jQuery

$("#selectboxId").change(function() {
    $('#pb1').progressBar(this.value);
});
...

Please fill the form - I will response as fast as I can!