Request Assistance on HTML5 Banner [closed] - javascript

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.

Related

Find a gibberish text within body using javascript [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 1 year ago.
Improve this question
I am trying to find a gibberish text that appears in the body without any HTML tags wrapping it. The source of this text is unknown. Not sure which approach would be better to find and remove it of the page Javascript
example:
<body>
<div>section</div>
Qui3Er3^6k
</body>
I am trying to find the string Qui3Er3^6k using javascript and remove it off the dom.
Note: I am not using jQuery, would like to achieve it with Javascript
If you're looking to remove Qui3Er3^6k from the DOM, you can use String.prototype.replaceAll():
document.body.innerHTML = document.body.innerHTML.replaceAll("Qui3Er3^6k", "");
<body>
<div>section</div>
Qui3Er3^6k
</body>

How to include javascript with HTML in google sites? [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 8 years ago.
Improve this question
html and javascript work properly there as you can see.
but when I add this to a htmlbox in google sites, it shows an error saying "1+1: URI unknown:///unknown is malformed"
Help me,
thanks
Here's my html and javascript
[1]: http://jsfiddle.net/TvHdU/4/
Make sure when you hit page create that "webpage" was chosen in the dropdown.
When the box comes up to edit the page, make sure that you click the html icon in the edit box.
Copy the html you provided, and pasted it into the page and below it wrote script tags to contain the javascript you provided.
<script>
//your js code here
</script>
Since Google restricts their sites, you have to use Google APIs to obtain the js code you need in order to make the Google Gadget work. Here's the API site
This should give you what you need in order to get you Google Gadget working with JavaScript.
You can view the working google site I just created here, then click on "include html" link on left bar under "Home".

Load page then execute javascript [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 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();

Why would JavaScript work correctly in HTML body but not as a JavaScript file in the HTML header [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
This doesn't work (placed inside the HTML header tag):
<script src="files/js/animater/index.js" charset="utf-8"></script>
But this works fine (placed inside the HTML body tag):
<script>
$(function() {
$(".active").animate({height: "10%"}, 5000);
});
</script>
Why does the last one work correctly and the first one doesn't?
Take out the script tags in the .js file.
In index.js file write this way,
(function() {
$(".active").animate({height: "10%"}, 5000);
}());
I hope you'll enjoy :)
You need to run your function some how. Like
<body onload="animate()">.
Otherwise you will need some on document load script in your jquery file. More Info
You may need an opening slash in your source path: src="/files/js/animater/index.js" and you shouldn't need the character set attribute. You may also need to add type="text/javascript" as an attribute.

Add just a </div> using JavaScript [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
I'm going crazy! :)
I need a way to add a closing </div> before another element. But everything I try the </div> gets filtered out. The problem is, that this might be the only solution for me.
So please, please have a look to this and maybe you're able to give me a hint:
I'm building a bootstrap based template for LimeSurvey, a online survey tool. Their templates are completely done with tables and I try to find another way and to get it mobile friendly.
The template is separated into different files. For my issue this is:
-> Startpage
-> Navigator
-> Endpage
Normally it loads always a "Surveypage" between Startpage and Navigator. But there is an option which automatically puts all question directly under the startpage and therefore into my header. So in this case I need another '' or another way to close the header first.
So there's a
<div class="jumbotron">
and I have to close it before the element
<table id="ls-table" ... >
I already tried many JavaScript examples I've been able to find around the web. But none makes the job.
Thanks a lot!
Philipp
There are only two ways to manipulate a web page using JavaScript.
The DOM, or document object model.
Via string-manipulation of the HTML.
Most web browsers will NOT allow you to do #2 directly on an already-loaded or loading document. At best, you could find a situation wherein you read the HTML of a <body> and then re-parse it. But doing so is an amazing amount of work for very little effort.
Look into the insertBefore method on the DOM, which will let you grab that <table id="ls_table" > element and move it from within that <div> to being a child of said <div>'s parent, immediately after the offending element.

Categories

Resources