Load page then execute javascript [closed] - javascript

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 8 years ago.
Improve this question
I need a way to automate on startup opening a URL then once the url has loaded call an on page function
And i have no idea how to approach this, I cant think of a way to do it via powershell and I dont know any other language very well any help would be appreciated even more so if it was written for a 5 year old.

Im not sure if im understanding correctly... but maybe you are looking something like this:
<html>
<head>
</head>
<body>
<!-- Put your html here -->
....
....
....
<!-- Scripts the bottom of the page -->
<script>
startup_function();
function startup_function(){
alert('Hello');
}
</script>
</body>
</html>

PLease keep your javasript file inside body after html . and use
window.load();

Related

How to call a he.js function to decode a JSON output element [closed]

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 6 years ago.
Improve this question
I have included the he.js file before my closing </body> tag.
But I need to call a function to have it decode my JSON output for the <figcaption> in a lightbox gallery.
How would I do this? I've tried the following but really not sure what I'm doing.
<script>
function(he)
{
root.he = he;
});
</script>
Apologies for the noob question...
This is the website in question
Once he.js included, you just need to use the he variable.
<script src="he.js"></script>
<script>
(function() {
console.log(he.version);
})();
</script>

How to show an html element from another page in my page? [closed]

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 6 years ago.
Improve this question
Sorry, I'm new in web developing so I don't have any idea this can be done or not.
There are two pages:
www.this-is-not-my-page.com
www.this-is-my-page.com
In 2nd page, is there any way to get any html tag's inside elements to my page ?
for example: the pattern of 1st page:
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<p class="sample">
bla bla bla...
</p>
</body>
</html>
now, in 2nd page(which I'm creating), I want the content from 'p' element with "sample" class(no need to get the class).
Can this be done, and if so, what do I need to know and where do I start?
Unless you use iframe, i dont think this can be done with just javascript/jquery.
Although, if you use PHP, you can use the PHP Simple HTML DOM Parser. http://simplehtmldom.sourceforge.net/manual.htm

Basic ReactJS application [closed]

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 decided to write a simple page using ReactJS, but I'm new to it. The code snippet below doesn't work for an unknown reason (at least for me). What's wrong wrong here?
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/react/react.min.js"></script>
<script src="bower_components/react/react-dom.min.js"></script>
<script src=bower_components/babel/browser.min.js"></script>
</head>
<body>
<div id="my-div"></div>
<script type="text/babel">
var Message = React.createClass({
render:function(){
return <h1>Hello, world!</h1>
}
});
ReactDOM.render(<Message/>, document.getElementById('my-div'));
</script>
</body>
</html>
The only thing that I can imagine is wrong with this code - is wrong path to scripts. Check console for problems with such problem.
Try to use maybe a CDN react instead of these from bower and tell what result is. Also, if you don't want to try CDN maybe try to add "/" before bower_components, that is
../bower_components/react
/bower_components/react
(wild guess)
Dom
React
I am very sorry for posting a silly question. I made no mistakes in my code except for one.
src=bower_components/babel/browser.min.js"
I missed a quote symbol. It should be:
src="bower_components/babel/browser.min.js"
Anyways, thank you for your attempts to help me.

Javascript a.hover doesn't work [closed]

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 took this css theme which is working with javascript and i have a problem with the a.hover (not working):
http://cssdeck.com/labs/zg4cr9hu
This is the first time i use javascript and i think that the problem comes from the jquery.min.js file i took from the library...
In the <head> i wrote in the html page :
<script src="script_intro.js" type="text/javascript"> </script>
<script src="jquery.min.js" type="text/javascript"> </script>
Is this where the error comes from ? Or should i put something in the js file that i didn't touch (seems good without errors)...
Thanks in advance for answers :)
If you are using jQuery in your first script you have to invert the lines, jQuery first and after the scripts that make use of jQuery.
<script src="jquery.min.js" type="text/javascript"> </script>
<script src="script_intro.js" type="text/javascript"> </script>

Request Assistance on HTML5 Banner [closed]

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 9 years ago.
Improve this question
Salutations! fellow developers, I am kind of stuck in a pickle here. I managed to create a HTML5 animated banner for my blog. After the exported content I received these two files:
i) banner.html --> I can change the name of this to whatever I want and functions perfectly.
ii) sprite.js --> When I change the files name, location and content. The "banner.html" automatically stops to functioning/working.
Is there a possible way that I can just have the "banner.html" file to function properly with my content without the "sprite.js".
-If yes, please share your solution.
-If no, please explain alternative working solution that you deem necessary.
Thanks to anyone who had answered.
-LEO
You can include scripts directly into HTML documents with the SCRIPT tag:
Substitute
<script src="sprite.js"></script>
(which has to be somewhere inside the HEAD tag of your document) with
<script>
<!--
//contents of sprite.js go here
//-->
</script>
Open your banner.html in a text editor.
There should be a line line
<script src="sprite.js"></script>
Replace it with
<script>SOURCE_OF_SPRITE.JS</script>
Of course "SOURCE_OF_SPRITE.JS" should be the actual source.

Categories

Resources