[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 9570
  • Last Modified:

Alternative for Firefox for style="word-break:break-all;"

style="word-break:break-all;"

works in IE and breaks a long line with no spaces. Is there an alternative for Firefox and Safari because it won't work in these browsers? Thanks.
0
wilcor14
Asked:
wilcor14
1 Solution
 
lbertaccoCommented:
That's a microsoft extension, not supported by firefox. You can use javascript to generate the output and insert breaks
0
 
vidhubalaCommented:
i know its not working in firefox. i am looking for solutions?
0
 
micron98Commented:

<html>
<head>
<script language='javascript'>
//<![CDATA[
window.util = new Object();
window.util.wrap = function(e,v){
  if(( /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) )){
    e.style.wordBreak = "break-all";
    e.innerHTML = v;
  }else{
    e.innerHTML = v.split('').join('<wbr>');
  }
};
window.util.keyCode = function(e){
  return e.which || e.keyCode;
};
window.util.element = function(e){
  return e.target || e.srcElement;
};
function input_onkeyup(event){
 
  if(window.util.keyCode(event)!=13)
    return true;
  var table = document.getElementById('table');
  var tr = table.insertRow(0);
  var td = tr.insertCell(0);
  
  window.util.wrap(td,window.util.element(event).value);
}
//]]>
</script>
</head>
<body>
Input : <input onkeyup='return input_onkeyup(event)' size='80'>
Input text and hit enter.
<table id='table' width='300px' border='1'>
</table>
</body>
</html>

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now