<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function init(){
document.getElementById('test2').innerHTML = '1 2';
}
</script>
<style type="text/css">
#test{
white-space:pre;
}
#test2{
white-space:pre;
}
</style>
<title></title>
</head>
<body onload="init();">
<div id="test">
1 2
</div>
<div id="test2"></div>
</body>
</html>
Here is an example page showing my problem. I have two divs. Each has this text '1 2' with white-space. The only difference is that one is injected dynamically and one is in the html itself.
If you open the above page in IE7, the text in div test2 doesn't respect white space. How can i get the same behavior for the text that is dynamically injected??
P.S. My doctype is triggering standards mode on IE7.
Have you tried substituting white space with
Alternatively, you could try innerTEXT instead of innerHTML
Related
I would like to apply jQueryUI's tooltip to elements in the TinyMCE editor, however, they do not appear using FF, and are buggy using IE and Chrome. I've experimented applying jQueryUI's tooltip to elements in an iframe, and get similar results. My script is below, and a demo is at http://jsbin.com/abEkOnO/1/ (note that the iframe JS had to be disabled as it causes a proxy error using jsbin). I think the tooltips are being created, however, maybe the CSS is relative to the iframe and not the document. I've also experimented by creating my own tooltip plugin (http://jsbin.com/AzaKARe/1/), but also get funky results.
How can I use tooltips on elements in the TinyMCE editor?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>IFrame and tooltips</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css" type="text/css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js" type="text/javascript"></script>
<script src="http://tinymce.cachefly.net/4.0/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({'selector': "#tinymce"});
$(document).ready(function(){
$('.tooltip').tooltip();
$('#click').click(function(){
console.log($('#iframeID').contents().find('.tooltip'));
$('#iframeID').contents().find('.tooltip').tooltip();
$('#tinymce').html('<div class="tooltip" title="Some Div4">Some DIV4</div><div class="tooltip" title="Some Div5">Some DIV5</div><div class="tooltip" title="Some Div6">Some DIV6</div>');
var t=tinymce.editors['tinymce'];
t.load();
console.log($(t.getBody()).find('div.tooltip'));
$(t.getBody()).find('div.tooltip').tooltip();
});
});
</script>
</head>
<body>
<button id='click'>Click</button>
<iframe src="iframe_page1.html" id="iframeID"></iframe>
<div class="tooltip" title="Some Div1">Some DIV1</div>
<div class="tooltip" title="Some Div2">Some DIV2</div>
<div class="tooltip" title="Some Div3">Some DIV3</div>
<div id="tinymce"></div>
</html>
iframe_page1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>Bind</title>
<style type="text/css">
.toolTip {width:100px;}
.myTooTip {
z-index:99999;
border:1px solid #CECECE;
background:white;
padding:10px;
display:none;
color:black;
}
</style>
</head>
<body>
<div class="tooltip" title="Some Div7">Some DIV7</div>
<div class="tooltip" title="Some Div8">Some DIV8</div>
<div class="tooltip" title="Some Div9">Some DIV9</div>
</body>
</html>
In your case the e.pageY was problem,
as tinymce creates a iframe, the e.pageY is set to 0 from current location(of tinymce),
So the tool tip again goes to Y=respective to mce position. You need to handle it manually,
I have updated the JSbin with some tweaks,
this will solve the issue,
although you have to do some small tweaks, for 100% accuracy
Edit : Updated JSBin with JQuery UI,
Undated Link of JSBin
This works fine without any problem on my side, the problem was we were calling the same function twice and in iframe the mouseOut event is not passed to its parent window, that's why tooltip generated was not getting closed.
I have changing codes and this is simple tooltip that works same as in the iframe above. in example.
I have just removed redundant instance of the tooltip by changing class name :)
I hope this will do finally
I can't set the font-size of a text input from the style sheet. However, it works fine by setting the style attribute.
This works:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text-htmlcharset=utf-; 8" />
<title>Test</title>
<style type="text/css">
#about {
}
</style>
</head>
<body>
<input id="about" type="input" value="anything" style="font-size:21pt;" />
</body>
</html>
This does not work (font-size is ignored):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text-htmlcharset=utf-; 8" />
<title>Test</title>
<style type="text/css">
#about {
font-size:21pt;
}
</style>
</head>
<body>
<input id="about" type="input" value="anything" />
</body>
</html>
What am I missing? Surely, you're not expected to use inline style for all text inputs? That seems pretty tacky and redundant in some cases. Thanks a bunch!
Change <style type="text/javascript"> to <style type="text/css">
You are confusing the browser because it is looking for JavaScript code, but you are feeding it CSS. <script> tags should be used for javascript, and <style> tags for CSS.
Your style block has a type of text/javascript. Remove that and it'll work fine.
I am trying to position a <span> relative to a particular image. I must use the XHTML Transitional doctype because that is what the application has been using since years before I ever laid hands on it and too much depends on it.
The following code correctly positions the <span> way off to the side:
<html>
<head>
<style type="text/css">
span.tooltip {
z-index:1000;
position:absolute;
top:200;
left:600;
}
</style>
</head>
<body>
<span class="hasTooltip">
<img src="https://www.google.com/images/srpr/logo3w.png" />
<span class="tooltip">Tooltip!</span>
</span>
</body>
</html>
However, this code breaks the <span> position, and it always appears in the same spot no matter what the left or top values are:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
span.tooltip {
z-index:1000;
position:absolute;
top:200;
left:600;
}
</style>
</head>
<body>
<span class="hasTooltip">
<img src="https://www.google.com/images/srpr/logo3w.png" />
<span class="tooltip">Tooltip!</span>
</span>
</body>
</html>
How can I correctly position this <span> element with the XHTML Transitional doctype?
Use top: 200px and left: 600px. They work in any mode, whereas if you omit `px', it is incorrect CSS code and only works in Quirks Mode.
I have the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testing PasteHTML.com</title>
<link type="text/css" href="http://optdev.shellprompt.net/css/jquery-ui-1.8.1.custom.css" rel="stylesheet">
</head>
<body>
<div class="notification" id="notification-message">
<div class="ui-widget">
<div style="padding: 0 .7em;" class="ui-state-error ui-corner-all">
<span style="float: right;cursor:pointer" onclick="$x_Remove('notification-message')" class="ui-icon ui-icon-closethick"></span>
<div id="message" style="float:left">Invalid Login Credentials</div>
</div>
</div>
</div>
</body>
</html>
Both the Message and "X" apear outside of their parent div. How do I place them inside their parent?
Here is a demo http://pastehtml.com/view/bngl4k1th.html and I would like it to look like JQuery UI Theme http://tinyurl.com/dbqg2t Alert message
Just been working through the jQuery UI Theme and I was missing the ui-helper-clearfix class once I added that it worked perfectly.
You can either add overflow:hidden to the parent tag or a new div with the clear:both property, before ending the parent tag.
You can play with my code here:
http://jsfiddle.net/gqQnd/
Basically I want to have a div of content to have a semi-transparent border.
The border is semi-transparent but the insider div also become semi-transparent.
I want the inner div to be white BG
Anyone has suggestion?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
#transparency {filter: alpha(opacity=75);opacity:.75; -moz-opacity:.75; background-color:#ccc;border:5px solid #333; position:absolute;top:50px; left:50px;}
#cont {background-color:#fff;filter: alpha(opacity=100);opacity:1;}
</style>
</head>
<body>
This is so cool way to do this
<br />
This is so cool way to do this
<br />
This is so cool way to do this<br />
This is so cool way to do this<br />
This is so cool way to do this<br />
This is so cool way to do this<br />
This is so cool way to do this<br />
This is so cool way to do this<br />
This is so cool way to do this<br />
This is so cool way to do this
<div id="transparency">
<div id="cont">
<div>
This is header
</div>
<div>This is body</div>
</div>
</div>
</body>
</html>
Your styles for #cont are actually being applied (hence the white background, even if it is semi-transparent). The problem is that opacity is inherited, and so if you apply it to a parent element, there's no way to stop it being applied to the child elements.
You could use an rgba value for the border-color, but then you get dark corners in Chrome and Safari (I think), where the borders overlap. Read about it here (with workarounds).
What about just setting an rgba background on the parent, with some padding?
http://jsfiddle.net/Kp7JJ/
Update: see css3please.com for cross browser support for rgba, e.g. you will need to apply a Microsoft filter in the CSS to get it to work in IE
Here is an option how to do this, but in this case your popup will be with the fixed size and I don't know if it's possible to make it flexible without javascript (jQuery) with only css
http://jsfiddle.net/gqQnd/13/
Without the use of a rgba background, i would recommend you to create a container containing two divs. One for the opacity, the other for plain color.
The cons are that you can't user without knowing the height and width of the div you're going to create.
But it's working in every browser :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="fr">
<head>
<title>my super page</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<style type="text/css">
body { background:#EF9; }
.container { width:200px;height:140px; }
.container > div { width:196px; height:136px; position: absolute;}
.c-opacified { position:absolute; border:2px solid #000;opacity: 0.5;-moz-opacity: 0.5;filter:alpha(opacity=50);}
.c-plain { background:red;margin:2px;/*because we have a border: 2px */}
</style>
</head>
<body>
<div class="container">
<div class="c-opacified"></div>
<div class="c-plain"></div>
</div>
</body>
</html>