I have banner HTML code if people goes to click on a text, the click should open my banner HTML page. I need a clickable text to open my HTML page. Below is my banner HTML page, i need clickable text for below banner HTML. so i need java code to open below html page on click event.
<script type="text/javascript" src="http://adhitzads.com/787096"></script>
HTML
<div id="div">TEXT</div>
javascript
$("#div").click(function () {
window.location.href="https://www.google.com";
});
and include any latest jquery...you can use
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
Related
Hello I tried to put ad banner on my website but it doesnt work (i have some problem with javascript) but iframes works so I will like to make a iframe from it (<iframe></iframe>).How i can do it ?Here is the code :
<script data-cfasync="false" type="text/javascript" src="//www.bitcoadz.io/display/items.php?5831&1627&468&60&1"></script>
iframe sample
$('<iframe>', {
src: 'http://google.com',
id: 'myFrame',
frameborder: 0,
scrolling: 'no'
}).appendTo('.accordion');
or
$('<iframe id="someId"/>').appendTo('#someDiv')
.contents().find('body').append(response);
someDiv is id where you want to append iframe. response is what you want to append in iframe.
I got in a database some html textparts. Normally they should make one whole html mail body with one html tag and one html close tag and also one for the body.
Sometimes these textparts contain for each line a html open tag and close tag and also a body open and close tag like this:
<html>
<body>
test1
</body>
</html>
<html>
<body>
test2
</body>
</html>
If I try to display a html page with 2 full webpages like in the example above in google chrome or IE of firefox it displays the content correctly and just displays the second page underneath the first. Also inside a mail client that uses html layout this works out fine.
Now in an application I have to display the content of the mail body in a htmlviewer.
I use javax.swing.text.html.HTMLEditorKit for this and this works fine if I have only one page. But when I got 2 or more it just shows the first one. I tried to embed the code inside another html tag but this didn't solve the issue.
Is there a method to display this webpage without rewriting the html code?
Maybe some option of javax.swing.text.html.HTMLEditorKit ?
Is it possible to run JavaApplet when you press a button , or when you click on the image on the webpage?
Maybe you guys can share any example, related html/jscript/jquery?
What is wrong with my code at this point?
<html>
<script>
function openApplet(){
var attributes = {codebase:'.',
code:'d.Applet',
archive:'Applet.jar',
WIDTH=500, HEIGHT=300} ;
}
</script>
<body>
<applet id="myapplet"
CODEBASE="."
ARCHIVE="Applet.jar"
CODE="d.Applet"
WIDTH=500 HEIGHT=300
style="visibility:hidden;"
>
</applet>
<input value="Applet_on_Click" onclick="openApplet()" type="button">
</body>
</html>
I'm just looking for very simple solution. Click on the image , applet shows up, click on the different image , another applet will show up. Or maybe these things can happen when we press a button too?
Update
Thank you slowpoison for the information!
But I'm missing something.
There is my original code now:
http://www.text-upload.com/read.php?id=360320&c=7544773
This is working just with pure html. But there is no action when you click on the button.
If I disable this row "style="visibility:hidden" , applet will show up without a click.
I wan't to show applet just after the button click. :(
You should add the applet tag to the document in the onclick handler.
var applet = document.createElement("applet");
// fill in various attributes for applet
// ...
// "install" the applet
document.getElementById("appletContainer").appendChild(applet);
I have a problem.
I have used a jsp page which contains multiple frames.In one of these frames there is logout button. If i logout only that part changes and not the whole page(as frame is just a view).
So the question is how can i make the whole jsp page(The one containng multiiple frames) to transit to login page back??
What you could do is to add target="_top" to your link or you can use javascript to navigate using your top frame:
self.parent.location= "Logout URL";
Take a look at this for reference :
LINK
LINK
Or else, what you can do is, into logged out page, add a javascript code to remove the frames redirecting your document to the top frame:
<script type="text/javascript">
if (self.parent.frames.length != 0){
self.parent.location=document.location.href;
}
</script>
I am generating an HTML email using a java program and need a Hide/Show button for some queries,
What would be an ideal approach for this?, shd i call a javascript from java program to do the same?.
I have a javascript module to do the show/hide feature but not sure how to integrate this to a java program.
Thanks..
Javascript is completely independent from any server-side framework or language, such as Java.
If you want to show or hide an HTML element on a page, try the following JS code:
document.getElementById("id").style.display = 'none';
And then, when you generate the HTML email using Java, include the queries you want to hide in a <div> with a specified ID.
Add a class to your generated html tags and use css to control the visibility and other styling.
<style type='text/css'>
.hid {display: none;}
</stle>
<div class='query1 hid'>...</div>
<div class='query2'>...</div>
<div class='query1 hid'>...</div>
Then update your javascript to manipulate the class attribute.
//in jQuery...
$("btn1").click(function() {
$(".query2").addClass("hid");
$(".query1").removeClass("hid");
});