I need to open a page inside another page without the horizontal scroll bar in the inner page.
I don't want to use <iframe> tags on my page. Is there any substitute to the <iframe> tag??
If this is about the scrollbars (you mentioned that in your comment), you can hide/show them using stylesheets - try the following:
<body style="overflow-y:hidden; overflow-x:hidden">
...
</body>
You can use the styles on other tags (textareas etc.) as well.
PS: If you clarify your question, it's a good idea to edit the original post instead of commenting - this will make it easier to understand your question.
Best way to avoid IFRAME is to use AJAX. If you would use jQuery it is as simple as that:
$('#yourDIV').load('http://someurl.com/example.html');
Where #yourDIV is ID of any element you want, DIV for example.
Maybe <object> or <embed> or something like that. I think you can put an html there. But that would be sort of the same, i guess...
If you want to validate against strict, <object> should be the way to go.
<object data="example.html" type="text/html" width="500" height="300"></object>
Please note that MSIE 6 doesn't support html object tags.
Related
Hello I'm trying to make the following:
<div id="myid" class="myclass" myownattributehere="somevalue">hellooooo</div>
Is it possible to create a hidden attribute in a div like such, "myownattributehere" or is there another way to do this?
I've heard of putting anchors in to do this? Simple or can it be done via div only?
You can use HTML5's data attribute.
<div id="myid" class="myclass" data-myownattributehere="somevalue">hellooooo</div>
Use data-my-own-attribute-here="...".
Make sure to have HTML5 DOCTYPE: <!DOCTYPE HTML>
In JavaScript, you can access it like this: document.getElementById('myid').getAttribute('data-my-own-attribute-here').
Or in jQuery, access it like: $('myid').data('myOwnAttributeHere').
See also HTML5 data attributes.
Use html5 data attributes:
<div data-your_attribute_name="value"></data>
You can do this on almost any DOM element.
Yes, If "SEO" is not important for you, you can use like this. But it wil not be a valid usage in w3c validatain process. Also after using like this you can "get" or "set" this attribute via jQuery
...
$("#myid").attr("myownattributehere");// get
...
$("#myid").attr({"myownattributehere": "somevalue"});// set
My problem is i wanna have some comment or disable some text inside value of href attribute of anchor tag.
I mean look like this:
Jquery.com
And when i click url redirect to stackoverflow.com and behave with domain.com like a comment or don't have any effect to link. Value in square bracket just like a comment inside url :[domain.com]
Can i do this without using jquery or javascript just like // or /**/ for normal comment inside code.
Please help me and thanks for reading.
Comments in HTML are this way :
<!-- [domain.com] -->
but that won't work in your case.
Why do you need to leave the [domain.com] if you want it to be effectless ?
Anyway, you could do something like that :
Jquery.com
and JS:
$('a.linkWithComment').click(function(e) {
$(this).attr('href', $(this).attr('href').replace(/\[(.*)\]/g,''));
});
Here's a JSFiddle for it : http://jsfiddle.net/kJDUB/
BUT be aware that this is absolutely not a recommended behaviour: SEO is probably broken, and there a many solutions to achieve same behaviour while being cleaner (like HTML5 tags : Jquery.com
and you can still reach the domain.com ...)
Is there a way to use pure html-code to display inside a frame instead of having to link to a specific URL/file?
For example:
NOT like this
<iframe src="left.html" name="left"></iframe>
but like this
<iframe src="here goes the html code" name="thank you SO"></iframe>
maybe you could inject HTML into the iFrame/Frame like described in this article:Injecting HTML into an IFrame by Michael Mahemoff.
Something like this:
var content = "<html><body><b>Hello World!</b></body></html>";
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
var frameDoc = iframe.document;
if(iframe.contentWindow)
frameDoc = iframe.contentWindow.document; // IE
// Write into iframe
frameDoc.open();
frameDoc.writeln(content);
frameDoc.close();
HTH,
--hennson
In HTML5 there appears to be a way to do this:
<iframe seamless sandbox srcdoc="<p>did you get a cover picture yet?"></iframe>
See here, supposedly this is the purpose of the new html5 srcdoc attribute.
According to the MDN, it appears only chrome will honor the srcdoc attribute at this time.
I wasn't able to get this attribute to work, so it's probably not a viable option at this time. As others suggested, using a div is probably a better solution.
I think that you cannot do this. Maybe you can try with a DIV an modify the content with javascript with innerHTML?
<div id='A' onclick="javascript:document.getElementById('A').innerHTML = 'Another content'">
Click me
<div>
srcdoc attribute of iframe is the simple method...
<iframe srcdoc="Your text goes here..."></iframe>
Can I create a link that has another link in html.
For example, I want to call an html form and the target will be the sidebar frame.
At the same time, the board frame will also go back to the previous page.
I don't think you would be able to do this in plain HTML, but you could probably use JavaScript to accomplish what you're after.
as steve mentioned you need a bit of javascript:
<iframe id="frame1"></iframe>
<a href="" onclick="update();return false;" >DoubleActionLink</a>
<script>
function update() {
window.open("http://www.stackoverflow.com");
parent.document.getElementById('frame1').src="http://www.w3c.org";
}
</script>
btw, you said
I want to call an html form
html form means you'll submit something to web server...so you aren't asking for pure html solution. Isn't ?
The w3 specification about links clearly states that this is forbidden ..
12.2.2 Nested links are illegal
Links and anchors defined by the A
element must not be nested; an A
element must not contain any other A
elements.
But you can handle the click event through javascript and do additional actions when clicked..
Use target="_top" and set the href to the URL of a <frameset> document which loads all the frames you want by default.
Better yet, don't use frames. They are more trouble than they are worth.
Below is some html I found in this jquery tooltip tutorial, the contents inside of content"" show up in the tooltip using javascript. I have never seen the content propert befre, I search on W3schools.com but and google but could not find anything about it. Is this a valid property?
Image Tooltip
sorry If I am overlooking this, I searched but just briefly, didn't look too much before asking this.
If you need to put custom attributes into an element, then use the html5 data- attributes.
Shamelessly copied from John Resig:
<li class="user" data-name="John Resig" data-city="Boston"
data-lang="js" data-food="Bacon">
<b>John says:</b> <span>Hello, how are you?</span>
</li>
This is most likely a custom attribute that the jQuery tooltip creators made up to hold the text for the tooltip. This is unfortunately a common practice with many jQuery plugins (although most put stuff like this in the rel="" attribute instead).
The downside of this is that if you are concerned with validatiing your HTML, this will cause that to fail.
The upside is that browsers will ignore attributes that they do not expect, so it will not affect the rendering of the page.
The proper place for this would be the title="" attribute, but without the extra HTML markup in the value (<span> in this case).
If you must have the extra markup, be sure to encode it:
title=">span<Image Title</span>"
But, be aware that if the Javascript fails, the user will see this encoded text as the built-in, browser-rendered tooltip.
Based on my initial searches on w3c, it seems that there is not such attribute "content" for a tag. The "content" attribute is for meta tag only. For tooltips you would use the "title" attribute. Also, I don't think html is allowed in a title attribute.
Image Tooltip
The content attribute doesn't exist. For tooltips you can use the title attribute (which works on alot of tags).
I thinks some browsers also use the alt attribute for tooltips on img tags, but this isn't the intended purpose of alt.