I am currently working on home.php where I have the following anchor link echo'd:
<a href='#?id=$thought_id' class='toggle-comment' data-id='$thought_id' style='padding-left: 5px;'> Comments ($num_of_comments) </a>
Now, when I hover over the Comments anchor, I get the id of the thought fine. It's just that when I hover over the link, or when I click the link, the url reads:
http://localhost/home.php#?id=210
So, 210 is the ID of the thought the comments anchor is assigned to, which works. But I do not understand why the file name is appending to the anchor link when it hasn't been defined to do so.
Even when I put <a href='#'> The URL still reads http://localhost/home.php#
Your browser is going to show you the full, canonical URL (including the anchor) when you hover over a link. It's the same link that will be copied to your clipboard if you right-click it and choose "Copy Link Location".
Related
I wrote some code for a real estate website and I have a little problem.
When I click on an ad, I want to make the page go back at the line. In order to do that I use the anchor but it doesn't work.
In the main page I've put this
In the page of the ad detail I've put this:
<a href="affitti.php?location=<?php echo $do_query[location];?>&&lang=<?php echo $lang;?>#<?php echo $do_query[id];?>" >
It has to return at the number id of the anchor, but it doesn't go back either.
Can anyone help me?
It seems that you don't have the anchor per se. Check that is not missing:
<a name="anchor"></a>
Click here to go anchor
either use the name attribute as Marcos explains in his answer or an id
see below
<a id="<?php echo $do_query[id];?>"></a>
and
<a href="affitti.php?location=<?php echo $do_query[location];?>&lang=<?php echo $lang;?>#<?php echo $do_query[id];?>" >
the first placeholder needs to have an id set and the actual link will reference the placeholder by #id
php newbie. echoing out links to product pages, the following code works fine:
<a href="<?php echo $rows[$product_buy];?>"<p>Click Here for Details</p></a>
but, would like to change text link "Click Here..." to an image of a button.
tried different ways, searched around, still haven't figured it out
You could simply style your link to look like a button (by giving it a class/id to make sure not all links are targeted) or you can put an img tag between the a tag.
<img src="path_to_img" alt="">
As of my requirement, I have placed an anchor tag in an IFRAME. When I click on anchor link, the page redirects the page in the IFRAME. Here, my requirement is when user clicks on anchor tag, (Which is in IFRAME) the page redirects to the main url (Not in the IFRAME). How can I do this in PHP or in JavaScript. Can you please say some thing?
try <iframe> <a href="#" onclick='window.location.href="homepage.php"' >click here </a> </iframe>??.. this ones javasript..
You're looking for the <a target= attribute. Setting it to _top will change the url of the outermost frame, and setting it to _parent will change the url of the parent frame.
I have a table in database which stores links submitted by users, I want my users to use those links whenever they want but the problem i am facing is
I can retrive and display the links with this code
<td width="560"><font color="#999">
'.$row['link'].'
</font>
</td>
but it generates link like this
http://XYZ.com/www.pxleyes.com/blog/2011/12/these-50-photos-will-blow-you-away/?action=tagtoload
so when the users click on this links it says page not found.
I want to open the links within my page so i have added ?action=tagtoload
which will load pages within my page with ajax call but the things are not working.
yes XYZ.com is my domain and for not generated links xyz.com/abc?action=tagtoload is working fine. its coming just below top header i want all external links to be below my header. can you please tell how i can open these links under my header. I want to display these links as anchored link so that user can see what these items are and when users clicks on these links it should open in iframe or whatever but under my header –
Guessing that XYZ.com stands for your domain:
add http:// for external links
Concerning the ajax-Problem:
Is it working with fixed, not generated links? Please post also the output of the php file and your ajax-code.
Please also define 'in you page': In an iframe? div? replacing your window?
EDIT:
To 'fix' you 'php-code':
<td width="560">
<font color="#999">
<a href="<?php print $row['link'] ?>?action=tagtoload" class="tagToload">
<?php print $row['link'] ?></a>
</font>
</td>
Please get familiar with html and php first.
do NOT use <font>, use css instead
use css instead of putting the width in the td as an attribute
read http://php.net/
I have a webpage with some frames within each other in it. Last frame loads a website with many URLs. Some URLs have target="_top" and some have target="_blank". When I click to URL with target="_top" it breaks all frames on my parent page and load this URL, but when I click URL with target="_blank" it leaves my parent page as is (with frames) and opens this URL in a new window. Now the question: how to do that when URL with target="_blank" clicked, beside the opening URL in a new window it breaks all frames in my parent page and close it? Thanks
<a href="your/url" target="_blank" onclick="window.location.href = this.href;">
Does that work? I'm not sure I'm entirely understanding the situation. Or do you want to "close" the parent page, e.g.
<a href="your/url" target="_blank" onclick="window.close();">