Jump to content

Rain Lover

Members
  • Content count

    60
  • Joined

  • Last visited

Community Reputation

3 Neutral

About Rain Lover

  • Rank
    Newbie
  • Birthday 02/17/1979

Contact Methods

  • Website URL
    http://htmleditor.gitlab.io/

Profile Information

  • Gender
    Male
  • Location
    Isfahan, Iran
  • Interests
    sports, music, Internet, reading, and travel
  1. Checkbox toggle in Chrome and Opera

    Steps to reproduce the issue: In your browser Settings select Continue where you/I left off under On startup. Navigate to the demo. Check the checkbox. Edit the text. Close your browser and reopen it. Or duplicate/clone the tab. Now as you see the checkbox is checked, but the textarea isn't colored. I tried it in the latest version of Chrome and Opera in Windows 10. I'm not sure about Safari, but it probably behaves the same way. Questions: Why does it happen? What's a cross-browser solution?
  2. Consider this: <input type="file" id="filePicker"> <script> document.getElementById('filePicker').onchange = function() { alert('Hi!'); }; </script> Even if you choose the same file and the filePicker value doesn't change, you'll see the alert box in Firefox. Any solutions?
  3. How to reload the parent frame

    Yes, that seems to be the problem. Then I need to put my question this way: How to reload the parent frame that's located on a different frame?
  4. How to reload the parent frame

    Sample parent code: <!DOCTYPE html><html><head><meta charset="UTF-8"><title>Parent</title></head><body><iframe src="https://dl.dropboxusercontent.com/u/4017788/Labs/child.html" width="200" height="100"></iframe></body></html> See it in action: https://googledrive.com/host/0B5jOXzxlxbMhYVF3b0lubjlDWm8/parent.html Sample child code: <!DOCTYPE html><html><head><meta charset="UTF-8"><title>Child</title></head><body><button onclick="myFunction();">Try it!</button><script>function myFunction() {parent.location.reload();}</script></body></html> I have tried many methods offered in similar questions to no avail, such as: window.parent.location.reload(); top.location.reload(); etc. What am I missing and what's the right approach?
  5. How to echo an external page from your domain

    Thanks for the answer, but: I don't know how to do it using cURL. Would you mind providing a snippet to use as a template? Doesn't it break the layout when the target page has non-absolute URLs and relative links?
  6. When I embed an external HTTP iframe into my HTTPS page, I get a mixed content error message: <iframe src="http://www.example.com"></iframe> To work around this limitation I'd like to echo the external page from my own domain. How should I do that? Thanks!
  7. Scroll without a scrollbar

    Sample form: <!DOCTYPE html><html><head><title></title><style type="text/css">* {font:13px arial; color:white;}body {background:black;}label {display:inline-block; width:50px;}input, textarea {margin:0; border:1px solid red; padding:0; background:green;}textarea {width:300px; height:100px;}</style></head><body><form action="#"><div><label for="entry_0">Name</label><input type="text" id="entry_0"></div><div><label for="entry_1">Email</label><input type="text" id="entry_1"></div><div><label for="entry_2">URL</label><input type="text" id="entry_2"></div><div id="parent"><textarea id="entry_3"></textarea></div><div><input type="submit" value="Submit"></div></form></body></html> I'd like to remove/hide the textarea scrollbar as it doesn't match my form style. I know I can use jQuery plugins to style the scrollbar, but they don't work reliably across different browsers/systems.To hide the scrollbar I can use textarea {width:300px; height:100px; overflow:hidden;}, but it completely stops Firefox scrolling through mouse and keyboard.I also tried the following workaround: #parent {width:284px; height:102px; overflow:hidden;}textarea {width:300px; height:100px; overflow-x:hidden; overflow-y:scroll;} It should work accurately if I add some script to calculate the parent division width: var textareaWidth = document.getElementById('entry_3').scrollWidth;document.getElementById('parent').style.width = textareaWidth + 'px'; But anyhow the above approach doesn't seem to work in Chrome/Safari:Demo: http://jsfiddle.net/RainLover/snTaP/ Open the above demo in Chrome/Safari >> insert some text into the textarea >> highlight/select a line and drag your mouse to the right and you'll see the scrollbar. Or use the keyboard keys Page Up and Page Down. Any corrections or other solutions?
  8. setTimeout to detect changes in a text field

    I tried id, but it didn't work: var iframe = document.getElementById('target'); function displayResult() { if (textarea.value) { iframe.open(); iframe.write(textarea.value); iframe.close(); } window.setTimeout(displayResult, 10); } I also updated my question for clarification.
  9. I wonder why the following sample code doesn't work properly: <!DOCTYPE html><html> <head> <title></title> <style type="text/css"> textarea, iframe { display:block; width:300px; height:100px; margin:3px; padding:3px; border:1px solid #CCC; } </style> </head> <body> <textarea id="field" onfocus="getFocus();" onblur="loseFocus();">This is some text.</textarea> <iframe name="target"></iframe> <script> var textarea = document.getElementById('field'); var iframe = window.target.document; function displayResult() { if (textarea.value) { iframe.open(); iframe.write(textarea.value); iframe.close(); } window.setTimeout(displayResult, 10); } function getFocus() { if (textarea.value == textarea.defaultValue) { textarea.value = ''; } } function loseFocus() { if (textarea.value == '') { textarea.value = textarea.defaultValue; } } displayResult(); </script> </body> </html> Demo: http://jsfiddle.net/RainLover/4ksMR/ The iframe content is supposed to get updated in real time -- as soon as the textarea content changes by keyboard or mouse. This approach is an alternative to the oninput event. But since oninput isn't well-supported across different browsers I decided to create a timer to compare the current text field value with its value in 10 milliseconds before.
  10. jQuery validation: display the focused field error message

    Thanks for the answer! Do you know how I can display the focused field error?
  11. Objective: I'd like to display the focused field error message in a container. What I've done so far: <!DOCTYPE html><html><head><title></title><style type="text/css">label {display:inline-block; width:60px;}</style><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script><script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js" type="text/javascript"></script><script type="text/javascript">$(document).ready(function(){$("form").validate({messages: { name: "Please specify your name.", email: { required: "We need your email address to contact you.", email: "Your email address must be in the format of name@domain.com." }, url: "A valid URL, please.", comment: "Please enter your comment." },showErrors: function(errorMap, errorList) { if(errorList.length) { $("span").html(errorList[0].message); } }});});</script></head><body><span></span><form action="#"><div><label for="entry_0">Name *</label><input type="text" class="required" name="name" id="entry_0"></div><div><label for="entry_1">Email *</label><input type="text" class="required email" name="email" id="entry_1"></div><div><label for="entry_2">URL</label><input type="text" class="url" name="url" id="entry_2"></div><div><textarea class="required" name="comment" rows="7" cols="35"></textarea></div><div><input type="submit" name="submit" value="Submit"></div></form></body></html> Demo: http://dl.dropbox.co...ample-form.html Problems: If you click the submit button, the container(span) shows the first error message, no matter which field was focused. Focusing on fields using the Tab key works well (except on the URL field), but focusing with a mouse doesn't update the span HTML correctly.
  12. Box model: lost parent element scrollbar

    Thanks for the answer, but I still don't understand the difference between the first and second example although I read your explanation a few times.
  13. Box model: lost parent element scrollbar

    In the second example the parent width is smaller than the child total width and the scrollbars should appear.
  14. Box model: lost parent element scrollbar

    The first sample shows scrollbars correctly: <!DOCTYPE html><html><head><title></title><style type="text/css">#parent {width:102px; height:101px; background:red; overflow:auto;}#child {width:100px; height:100px; margin:1px; background:green;}</style></head><body><div id="parent"><div id="child"></div></div></body></html> But the second doesn't: <!DOCTYPE html><html><head><title></title><style type="text/css">#parent {width:101px; height:102px; background:red; overflow:auto;}#child {width:100px; height:100px; margin:1px; background:green;}</style></head><body><div id="parent"><div id="child"></div></div></body></html> Why is that?Thanks!
  15. No fieldset padding top in IE8

    Many thanks for the answer! However, adding a margin seems better.
×