Jump to content

Nati323

Members
  • Posts

    93
  • Joined

  • Last visited

Posts posted by Nati323

  1. hello , i have seen here: http://www.w3schools.com/tags/tag_iframe.asp, that you specified the value of width and height pixels, so i concluded that pixels yes percent no, its right? because when i do to iframe width="100%" its work (at chrome at least).dose its work in all browsers and all versions? its legal? if not , with css its possible?

     

    edit:

    now i see this : http://www.w3schools.com/tags/att_iframe_height.asp , and you wrote there that in html 5 % dosent work. what i can do?

  2. hello , i have a <div> with class "nav" and i want that all the links inside will be design somehow.

    so i did that:

    .nav a:link , .nav a:visited  {	padding: 7px 20px; 	font-weight: bold;	font-size: 20px;	color: white;	text-decoration: none;}

    but its not working, what have i done wrong?

  3. i passing to getSel the object getSelection().

    so if toString remove the html code how can i get the selected text with the html ?

    EDIT:

    i dont think you right, because the the start and the end positions suitable to a string without html tags, so its have nothing with the toString method.

  4. hey, i have editable div , and i want to get the selected text from.

    the problem was is that i want that when i press some button in the page it will wrap the selected text with something, but it dosent work because when you press on the button the selection is gone so i did onmouseup event in the div that call the function getsel(below) that save the current selection:

    function getsel (s)  { text = s.toString(); start = s.anchorOffset; end = s.focusOffset;}

    and then when i press a my button i did this function:

    function show () {div = document.getElementById('bla');div.innerHTML = div.innerHTML.slice(0, start - 1) + "<b>" + text + "</b>" + div.innerHTML.slice(end);}

    its work great, but only with something like BBcode,because the getselection object refers to the selected text only without the html inside him, for example if i have in my div the next text: "Hello World";

    and now i will select the word "Hello" and bold it with my function it work great, but now if i want to bold: "World", there is a problem, because the location of the start and the end that i get from the getselection object match to the string without the html, and the innerHTML including the html tag and then when i use the location in slice method its not match to the innerHTML text.

    what can i do?

  5. first of all thank you very much, second:

     

     

    Regex can sometimes seem like the obvious solution -- until you benchmark the code and discover it is very slow

    you right in case like this one, where the rexexp is simple , so you can solve this with string functions, but if you have a complex exp like a URL exp and you want to bold the all url's in some text, what do you do then?

    what i mean that i remember that in some programming languages there is some thing like a variable that contains the match , for example :

    txt.replace(/[abc]/g, "<b> %match </b>")

    %match contains the match from the regexp, there is something like this in js?

    For example in php:

     

    $result = preg_replace('/([abc])/', "<b>1</b>" ,$my_text);
  6. no whitespace, i want to do something like this, suppose i have a string like this:

     

    a b c d e f g h a

    i want to change it to this :

     

    <b>a</b><b>b</b><b>c</b> d e f g h <b>a</b>

     

    2) i know it was just for the example...

  7. hello, i have a problem

    suppose in need to sress all a chars , so i do something like this:

    txt = "d c a vv x c x";document.write(txt.replace(/[a]/g, "<b> a </b>"));

    but, what i need to do if want to stress the chars a , b and c?

    txt = " a vv x b  d c c x";document.write(txt.replace(/[abc]/g, ? ));

    ?

     

×
×
  • Create New...