Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I need to fetch the contents under MY TITLE to appear as title within an image on the same page. For example this is a link from my blog and the title of the page appears within the image.
Just a code to fetch my title and use it within an image without having to copy paste manually every time. The structure of my URL is (title.php)
I presume you meant the page's title at the browser's tab, right? (question was a bit unclear)
If so, this value can be accessed in Javascript using
document.title
This is the cleanest way to get it, and the most effective one. There is a weird play if you want to use purely PHP to get it, however, I would stick to using this method if I were you.
For reference, here is the previous SO topic on getting page title in PHP
How to get page title in php?
If you wanted to use that value in PHP, you could use Javascript inside PHP by simply writing
echo '<script type="text/javascript"> document.title </script>';
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 months ago.
Improve this question
How to let user upload image in one page, and then display it in another page? User can change the image and it'll be changed also in the other page. Also, I'm talking about using php / js / jquery / mysqli anything that's most efficient. (I'm just a beginner in this field so it'll be appreciated if you use some simple language :))
Edit: Yes I said that I'm a beginner, but that doesn't mean I don't know a thing about coding. Also, I saw a few solutions from youtube & other stackoverflows questions, but all of them is about either uploading and displaying in the same page or not being able to change the image.
Format the image into Base64 string
store it in local-storage
In another page get it from local-storage and assign to the id or class.
Suggesting the link that already have answered for
How to save an image to localStorage and display it on the next page?
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I wanted to click on an image, which will call a javascript function. The function is intended to change from one page to another web page on the same site. I don't want to open() a new page, but an existing page within the current site.
I tried using an anchor tag, with the href targetting the url of the destination. But I dont want an anchor, I want to use a clickable image.
I also tried the window.open() method but ended up with lots of opened windows!
I then tried donuts "window.location.replace(newUrl);" which worked instantly. How do I vote-up donuts advice from pure time ago? Can't see no up-arrow to the left of the post?
You don't need JavaScript to make a button or image into a link.
For an image, as others have pointed out in the comments, just do
<img src="...">
For a button, see How to create an HTML button that acts like a link.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
As a disclaimer, I'm quite new to web development and even before I posted this, I have spent hours looking for answers but everything I have read did not help on what I want to do.
I'm basically trying to redirect to a certain page and then execute a php function which also require a variable to be pass to it and is inside a class.
I've read about ajax but people have said that theres no point using it if I want to redirect to another page anyway as its only good to use if you just want to reload a portion of the page.
The most simplistic way I can explain on what I want to do is, when I click on an image, I would like for a new page to be open and then in that said page is all the things about that image. For example, description about it, a short vid and maybe a comment section regarding the image clicked.
Please explain if what I'm trying to do is not possible and if so, please point me in the right direction as to what might be a better way of doing this.
You can just link to a php page and pass a request variable.
Link
// myPage.php
<?php echo($_REQUEST['someVar']); ?>
This will output "someValue" on the new page.
here's a really simple example:`
<img src="test_image.png" alt="your alt"> <!-- Simple link with a id attribute -->
`
On the PHP side:
image_infos($_GET['id']); //Call the PHP function with the image ID
function image_infos($id)
{
//Get your infos from the Server or whatever
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I've searched arround on Google but couldn't find a clear answer on my question. The idea of what I want to do is quite simple:
There's a site called "glws.org" with a bunch of <div>'s and <input>'s on the page. You can add strings to the URL (example: https://glws.org/#S76561198105687636A2280482163D16883436630920468625) and for different strings after the # in the URL, different values are put into the <input>'s. The site reads the string after the # and has a script that converts it into values and puts the values in read-only <input>'s. Because they are <input>'s and not <p>'s for example, I can't just read them by printing out the HTML code.
Is there a way to retrieve the value in the input fields through a Java program? I've tried to read the source code of the page with Sockets but that obviously just prints the <input> tags without the value because it's not like a <p> or something.
Any help is appreciated!
You can use Selenium web driver to do browser actions on the website programatically and wait till some elements appear on the page.
https://code.google.com/p/selenium/wiki/GettingStarted
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Right now I have a simple website that looks something like this.
http://i.imgur.com/opllm1Y.png
I need a way to change the image and the description at the same time but keep the navbar and title the same as I do not want 100s of pages on for my website.
Would it be best to put image url's into a database and call it out with php along with the description?
Or is there another way to do it.
Does your content need to change without leaving the page?
If so, look into using jQuery and AJAX.
goto jQuery offical web site, and download the javascript file from them, then upload it to your server.
just before the closing tag for body, insert this:
<script src="your.jquery.file.js" type="text/javascript" ></script>
Now, on your page, a simple way to do this is make sure your img and div tags have id's:
<img id="image_to_change src="start.png">
<div id="text_content"></div>
After the script tag you included, use another script tag, this time, we're gonna put some javascript of our own in here
<script type="text/javascript">
$(document).ready(function(){
$('#image_to_change').onclick(function(){
$('#image_to_change').attr('src', 'next_image.png');
$('#text_content').text("The text you want to insert");
});
});
</script>
This of course is very crude, but it should give you a good starting point.