Jump to content

Gokhan

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by Gokhan

  1. It's possible that local storage doesn't work unless you're on a web server as opposed to opening the file from your hard drive.

     

    You are right, it works on the local server. Thanks a lot.

  2. Hello All,

     

    I have found an example on stackoverflow and tried it however it doesn't work for me.

    <!DOCTYPE html><html><head><title>Chrome localStorage Test</title><script type="text/javascript" >var handle_storage = function () {alert('storage event');};window.addEventListener("storage", handle_storage, false);</script></head><body><button id="add" onclick="localStorage.setItem('a','test')">Add</button><button id="clear" onclick="localStorage.clear()">Clear</button></body></html>

    If the HTML document is opened in two separate tabs and "Add" button is clicked on one of the tabs it is expected that the other tab shows an alert. However I couldn't make it work. I tried it on IE, Chrome and Opera. What can be the reason it doesn't work for me? Is it possible that my browsers don't allow to use the local storage?

  3. This page explains Web Messaging: https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage

     

    The message event belongs to the Javascript window object:

    window.addEventListener("message", receiveMessage, false);

    Here's the documentation on how and why to use addEventListener for events: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener

     

    Actually I am going to learn JavaScript and I am not asking for an example which doesn't include JavaScript code. What I wanted was just to see "onmessage" attribute is working. Do you say it has no functionality for now (therefore there can't be an example which triggers "onmessage" attribute) althought the HTML5 specification includes it?

  4. You can find information about all Javascript events at the Mozilla Developer Network: https://developer.mozilla.org/en-US/docs/Web/Events

     

    Many events are only intended to work with Javascript. Event attributes inside the HTML, while not officially deprecated, shouldn't be used because it makes maintaining websites really difficult. It's important to separate content from behavior.

     

    Thanks for your answer but I have already read this page. However I want to see an example with attributes. My aim is to see how they work. I am not able to create an example as I am not so familiar with JS. Where can I find such an example. I just want to see how these attributes are triggered.

     

    I have made an attemp but it didn't work. The example codes are below:

    <!DOCTYPE html><html><head><title>Main Page</title></head><body><iframe src="frame.html" id="frame" style="height:60px"></iframe><form name="form">    <input type="text" name="name" value="Enter your name:"/>    <input type="submit"/></form><script>    var mainw = document.getElementById("frame").contentWindow    document.forms.form.onsubmit = function() {    mainw.postMessage(    this.elements.name.value,    "frame.html"    )    return    }</script></body></html>
    <!DOCTYPE html><html><head><title>Frame</title></head><body onmessage="receiver(event)"><div id="box">Your name is: </div><script>function receiver(event){   document.getElementById("box").innerHTML = event.data}</script></body></html>

    It doesn't work. If it is possible to make it work with some modifications could you please do this?

  5. Hello all,

     

    I was trying to use the event attributes but there is no example for these three attributes on W3Schools tutorials. Also I looked for it on Google and I coudn't find any.

     

    Could you please give me small examples which uses these three attributes? All the examples on internet uses JavaScript to provide this functions but I want to see how this attributes work. I cannot find out how to trigger these attributes.

     

    Thanks in advance!

  6. If you want to see why specifying the character set is important, try writing some Greek characters and change the charset to UTF-8.

     

     

    I tried what you said but it works correctly. I used the code below and I can see the Greek letters as it was written. What am I doing wrong?

    <!DOCTYPE html><html><head><title>Example</title><meta charset="UTF-8"></head><body><p>Αποτελεί την πλέον επιτυχημένη ομάδα στην ιστορία του</p></body></html>

    Also I tried the example shown in the link below, I changed the charset to UTF-16 and windows-1252 as advised and it still doesn't affect. Is there something unusual with my browsers?

     

    http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_script_charset

  7. Hello everyone,

     

    I am trying to figure out the use of charset attribute. However I couldn't find a good example. I used the charset value ISO_8859-7:1987, it is known as Greek and I expected to see my paragraphs written in Latin will be encoded different than it was written. However it is still encoded correctly. How can I see if it really works?

  8. Hello all,

     

    I try to add a favicon to an HTML page. It works when I use the code below:

    <!DOCTYPE html><html><head><title>Example</title><link rel="icon" type="image/gif" href="http://www.w3schools.com/tags/demo_icon.gif"></head><body><p>An example paragraph.</p></body></html>

    It uses the logo shown in the tutorial section. After that I downloaded that image and saved to the same folder as the HTML page I use. When I change the code to the below one it doesn't work:

    <!DOCTYPE html><html><head><title>Example</title><link rel="icon" type="image/gif" href="demo_icon.gif"></head><body><p>An example paragraph.</p></body></html>

    What is the problem here? When I refer to an adress on the web it works but when I refer a file in my hard drive it doesn't. I also try to use an .ico file generated online however it didn't work too. Could someone help me about my problem?

  9. Hello everyone,

     

    I am doing some experiment with <bdi> tag to understand it well. I have got a piece of code:

    <!DOCTYPE html><html><body> <p>User <bdi>William</bdi>: 100</p> <p>User <bdi>Henry</bdi>: 90</p> <p>User <bdi>علي</bdi>: 80</p></body>

    When I open it with Google Chrome it works as it is intended. It is said that IE doesn't support this tag. Therefore I opened it with IE to see what would happen if I didn't use the <bdi> tag. The result is that the Arabic name Ali and the number 80 is swapped.

     

    After that I used that code:

    <!DOCTYPE html><html><body> <p>User <bdi>William</bdi>: AA</p> <p>User <bdi>Henry</bdi>: BA</p> <p>User <bdi>علي</bdi>: BB</p></body>

    The code works as it is intended on both Google Chrome and IE. IE doesn't support the <bdi> tag but it works. Why? Why does it make sense to change the numbers with letters? Could someone please explain me the logic?

  10. for links.

     

    to target lines on a page (except html5)

     

    I am sorry but I couldn't understand it. Could you please explain it a bit more detailde. May be it can be better to go with the example above.

     

    1) I create a link named "Search Engine" with the <a> tag.

    2) The link goes to "Google". href attiribute does this.

     

    I understand until now.

     

    3) The media attribute says the linked page (Google main page in the example) is optimised for printing with the resolution of 300 dpi. But why would someone need to do this?

     

    - The Google homepage will not be open as a printable shape.

    - A visitor will not see this information if he/she doesn't view the source code.

     

    Then I wonder I am saying "it is optimised for printing with a resulotion of 300 dpi" to whom?

     

     

    I am sorry but I also couldn't understand what "to target lines on a page means". Could you please explain a bit detailed?

  11. Hello everyone;

     

    I don't understand the usage of the media attrübute for <a> tag. Let us say I write the code below. What does the media attribute do there? It will not open Google in a printable format. The tutorial says it is purely advisory. However the user of the website will not be able to see it. Then I wonder I advise the optimised conditions to whom? Could someone explain me why it is used with <a> tag?

    <!DOCTYPE html><html><body><p><a href="http://google.com" media="print and (resolution:300dpi)">Search Engine</a></p></body></html>
×
×
  • Create New...