Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
What's the best way to use javascript to target html elements included in an external php file?
I am adding/removing a class from my header whenever the client scrolls more than 20px from the top. The header is saved in header.php which is an included file in each page. This only works on html elements in the main pages. How do I target elements in the included files when sensing changes in distance from the main file?
Javascript works on the client. It sees only the final output from PHP and knows nothing about what mechanism PHP might have used to create it. Treat your header exactly as if it were part of the main document.
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 5 years ago.
Improve this question
I'm trying to create a webpage version control backup / log. Where if the webpage (including JS and CSS) gets altered it saves a static copy on the drive.
How do I get the CSS and javascript of a webpage? Getting the HTML is easy by simply connecting to the webpage and read the contents and return it. But how do I get the CSS & Javascript of this page too?
The system doesnt have direct access to the webserver(s) so I have to do everything over the network remotely.
My idea is I search the HTML I scraped for .css and '.js' and take everything until the first quote " and directly access the CSS / javascript file as webpage. But I think this might not be very reliable?
Not sure why this is marked as too broad. I'm asking how to get the CSS and javascript of a webpage. I reformed my question, hopefully its better now.
Instead of searching for .js and .css , I'd look for <script> and <link> tags instead and use their src and href properties respectively to perform another network request and retrieve those files for comparison.
This will be more reliable because you won't have to worry about the page's content containing js or css, and you could also use an XML parser to ensure things like single-quotes vs. double aren't an issue.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have a simple html page with div section. Div section contains several paragraphs <p>. I created separate div for every language. I want to show specific div corresponding to the user language.
I found that the language can be determined as follows
var language = window.navigator.userLanguage || window.navigator.language;
And div can be made visible as follows
document.getElementById(language).style.display="inline;"
However, for some reason, it doesn't work. I assume I don't understand something fundamental in page rendering process.
I will appreciate any help with this.
When modifying the style from JS you should not add any ';'.
try
document.getElementById(language).style.display="inline"
instead of
document.getElementById(language).style.display="inline;"
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm trying to generate HTML using PHP and have that HTML printed out and displayed on a site for a user to then copy and paste elsewhere. My problem, however, is that whenever I try to use print or echo statements and type in the HTML, the HTML is being rendered instead of simply just printed. I even put the HTML as a string into a variable and tried printing/echoing that variable but it was also rendered. Is there any way to literally just have the words I'm typing (which happen to be HTML) printed or displayed in some way on the page in a box or something of the sort?
if I understood your question, I think you should use htmlentities():
print htmlentities('<br>');
This wil show the tag instead of generate a new line.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I'm trying to change or remove errors from a HTML page I'm using firebug add in firefox and I have this part which I really don't where its writen :
is there a way to get the file where this is write .
thanks for any hint
Continuing from my comment: The highlighted element is dynamically added by a slider plugin e.g. like http://jqueryui.com/slider/ The clue is the classes like ui-slider-handler.
Look for the id="voltage" to find the place in the HTML where the div is and look for #voltage or ("voltage" or 'voltage') to see where the plugin is connect to it (in any jQuery or Javascript code).
I don't think you can get the exact path of the file, but check "View page source" option to see what files the page has been linked to.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I am using AJAX to display a table, I need to sort that rendered table at client side using JavaScript or jQuery or whatever is best.
I tried jQuery it is working fine when page is loaded but by dynamically writing html content into a div and there by sorting that rendered table is not working.
I think the problem is JavaScript is not working while rendering, I wrote some script alert while rendering html these tags works while rendering a page.
By using tablesorter plugin:
$("table").tablesorter();
re-running each time table is affected (i.e it will not be enought to run this command once when page loading is complete)