lundi 29 juin 2015

Django : HTML Table with iterative lists values

I am using Django framework and trying to build a table based on the values i have in a list:

list : [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [3, 3, 3, 3]] The table should be as shown below:

The code I have used is :

  html = "<html><body><br>" \
           "<table border=1 ><thead> <tr><th>result 1</th><th>result 2</th><th>result 3</th><th>result 4</th></tr><thead>{% for item in matrix %} {% for secitem in item %} <tr> <td> {{secitem[0]}} </td>  <td> {{secitem[1]}} </td><td> {{secitem[2]}} </td><td> {{secitem[3]}} </td>  </tr>    {% endfor %}{% endfor %} " \
           "</table></body></html>"

I am not able to get the exact table with the required rows in it. Any help is highly appreciated.![enter image description here][1]

Radiobuttons in a HTML form to remain editable when exporting to PDF

Running into a problem when generating an editable PDF form a html form.

I have a html form with text input fields and radio button selections. When user submits, it will generate an editable PDF (with user-entered data) to the server.

I am able to get the text input fields to remain editable in the PDF but not the radio button selections. These radio buttons automatically rasterized to images.

Is there a solution to this problem? Thanks!

Starting IE 11 from batch file - keeps previous tabs

I am using a batch file to kill all instances of internet explorer, and then start it again using a shortcut that is on the hard drive. The shortcut is a HTML file that has a URL & Login information in it. The IE version is IE 11. The site requires the browser to be Internet Explorer. The batch file is as follows:

taskkill /f /t /im iexplore.exe
start /max "iexplore.exe" "C:\Users\Public\Documents\mysite.htm"

The HTML file has:

<html>
<body onload='f1.submit();'>
<form id=f1 action="http://ift.tt/1IGI68z" method=post>
<input id=uid name=uid type=text value=user1 style="visibility: hidden">
<input id=pwd name=pwd type=text value=pass1 style="visibility: hidden">
<input type=submit style="visibility: hidden">
</form>
</body>
</html>

The problem is, if I X out of the browser, the next time the batch file is run, it opens it in a new tab. So, even though the "new" tab is logged in, the other old tabs are still retained when IE starts again.

How can you make IE 11 forget the last page it had open & force this to open in the first tab of a new browser each time?

Python extract info from a local html file [duplicate]

This question already has an answer here:

I have this local website and I want to extract each line after

<font color='000000'> <u>PATTERN:</font>

Here is the page source, it's an output from the program ApproxMAP on google code:

<! Created by program ApproxMAP by Hye-Chung(Monica) Kum>
<HTML><font size=5 face='Helvetica-Narrow'><b>
<font color='000000'> Cluster Support= [Pattern=</font>
<font color='000000'> 50</font>
<font color='000000'> % : Variation=</font>
<font color='000000'> 20</font>
<font color='000000'> %]; Database Support= [Min= </font>
<font color='000000'> 1</font>
<font color='000000'>  seq: Max=</font>
<font color='000000'> 50</font>
<font color='000000'> %]</font>
<BR>
<font color='a9a9a9'> cluster=0 size=3</font>
<font color='000000'>   =<100:</font>
<font color='434343'> 85:</font>
<font color='767676'> 70:</font>
<font color='a9a9a9'> 50:</font>
<font color='c8c8c8'> 35:</font>
<font color='e1e1e1'> 20></font>
<BR>
<font color='000000'> <u>PATTERN:</font>
<font color='000000'> {1,} {2,3,} {4,5,} 
</font>
<font color='000000'> =</font>
<font color='000000'> 5</font>
<font color='000000'> </u></font>
<BR>
<font color='000000'> {</font>
<font color='000000'> 1</font>
<font color='cbcbcb'> 12</font>
<font color='000000'> }</font>
<font color='000000'> {</font>
<font color='cbcbcb'> 24</font>
<font color='000000'> }</font>
<font color='000000'> {</font>
<font color='7f7f7f'> 2</font>
<font color='7f7f7f'> 3</font>
<font color='cbcbcb'> 25</font>
<font color='000000'> }</font>
<font color='000000'> {</font>
<font color='cbcbcb'> 1</font>
<font color='7f7f7f'> 4</font>
<font color='7f7f7f'> 5</font>
<font color='000000'> }</font>
<font color='000000'> {</font>
<font color='cbcbcb'> 26</font>
<font color='000000'> }</font>
<BR>
<font color='000000'> <u>PATTERN:</font>
<font color='000000'> {9,10,} {11,} {12,13,} 
</font>
<font color='000000'> =</font>
<font color='000000'> 5</font>
<font color='000000'> </u></font>
<BR>
<font color='000000'> {</font>
<font color='717171'> 9</font>
<font color='989898'> 10</font>
<font color='000000'> }</font>
<font color='000000'> {</font>
<font color='d3d3d3'> 11</font>
<font color='000000'> }</font>
<font color='000000'> {</font>
<font color='404040'> 11</font>
<font color='000000'> }</font>
<font color='000000'> {</font>
<font color='404040'> 12</font>
<font color='989898'> 13</font>
<font color='000000'> }</font>
<BR>
<font color='000000'> TOTAL LEN=</font>
<font color='000000'> 10</font>
<BR>
<BR>
</b></font></html>

In this case, I want to extract the following:

{1,} {2,3,} {4,5,} 
{9,10,} {11,} {12,13,} 

Here are some code I tried but none of them worked:

# First try
soup = BeautifulSoup('file:///H:/Approx_google_code/tiny20.html')
soup.findall('PATTERN:')

# Second try
re.search( "PATTERN:", 'file:///H:/Approx_google_code/tiny20.html')

# Third try
soup.body.findAll(text='PATTERN:')

# Forth try
soup.body.findAll(text=re.compile('PATTERN:'))

I've been stuck on this easy problem for so long that I started to wonder whether BeautifulSoup is the right direction. I'm totally new to HTML so any easy explanations / suggestions are welcomed, thanks.

document.getElementById is not working (Object doesn't support property or method 'getElementById')

The element that im trying to get is a checkbox, the content of the page is dynamically created by using ASP.Net.

here is the line where IE11 breaks;

<TD>
    <span id="spnFaxSelected" style="HEIGHT: 100%">
        <span class="">
            <input onclick="document.getElementById(&quot;COIÑAPPÑfax&quot;).checked=this.checked;document.getElementById(&quot;COIÑAPPÑfax&quot;).value=(this.checked)?&#39;on&#39;:&#39;off&#39;;OpenTransaction(this);"
                type="checkbox" id="COIÑAPPÑfax~chk" disabled="disabled" style="BACKGROUND-COLOR:#e4e4e4;" />
            <label for="COIÑAPPÑfax~chk">Fax</label>
            <input id="COIÑAPPÑfax" name="COIÑAPPÑfax" type="hidden" value="off" CAType="CACheckBox" onpropertychange="caCheck()" />
        </span>
    </span>
</TD>

the error that im getting in IE11 debugger is

Object doesn't support property or method 'getElementById'

Any one encountered this problem before?

EDIT: The code works fine in IE9, doesnt work in IE11

scrolltofixed - limit next item

scrolltofixed plugin does not seem to be changing to the next item in the list. See code below: http://ift.tt/1HtOSDZ

var learningObjectives = $('.learning-objective-header');
learningObjectives.each(function(i) {
  var learningObjective = $(learningObjectives[i]);
  var next = learningObjectives[i + 1];

  learningObjective.scrollToFixed({
    marginTop: 137,
    limit: function() {
      var limit = 0;
      if (next) {
        limit = $(next).offset().top - $(this).outerHeight(true);
      }
      return limit;
    }
  });
});

Using HTML5 Drag and Drop for list elements

I have HTML:

 <li class='has-sub'><a href='#'>Registration</a>
            <ul ondragstart="drag(event)" draggable="true">
               <li><a href='1'>Register for Classes</a></li>
               <li><a href='2'>Retake a Course (Academic Forgiveness)</a></li>
               <li><a href='3'>View Your Holds</a></li>

and so on. It's a menu that displays some links. I also have another menu that should allow the user to drop "favorite links" into it:

 <div id="myFavorites" ondrop="drop(event)" ondragover="allowDrop(event)">
    <ul>
        <li class='has-sub'><a href='#'>My Favorites</a>
             <ul id="favoritesList">
                <li><a href='#'>Test1</a></li>
                <li><a href='#'>Test2</a></li>
                <li><a href='#'>Test3</a></li>
                <li><a href='#'>Test4</a></li>
             </ul>
         </li>
    </ul>   
</div>

My javascript appears to be correct:

function drop(ev) {
    //alert("Got here");
    ev.preventDefault();
    var data = ev.dataTransfer.getData("text");
    //var html = ev.dataTransfer.getData("text/html");

    document.getElementById('favoritesList').appendChild(document.getElementById(data).cloneNode(true));
//$("#favoritesList").append(document.getElementById(data));
}

However, when I drag the top menu to the bottom, it doesn't append the entire "li" element to the favorites, only the element inside of it. I've also tried adding the ondragstart="drag(event)" draggable="true" to each individual "li" element, but it's producing the same results. Any suggestions?

Getting and Setting CKEditor HTML in a C#.net Winform App

I am trying to use CKEditor in a Winform app to load, manipulate, and store HTML content in a Sql Server database.

I found this great post on how to get CKEditor onto a winform:

Can the CKEditor be used in a WinForms application for (X)HTML editing?

However it does not detail how to load the HTML content or extract it once the user has manipulated it.

I have tried:

webBrowser1.Document.GetElementById("editor1").InnerText;

However that returns the initial data that was loaded into the editor, after it is manipulated by the user, it still returns the same value.

If someone could expand on the answer in the link above with some code that loads the editor with some content and some code that displays a message box in the WinForm application with its current content, I would really appreciate it. My suspicion is that it requires some more JavaScript in the html file that is initially opened but I know nothing about javascript and I've spent several days trying to trip my way through it with no success.

Thanks in advance.

vbscript minify/uglify tool - suggestions

I'm looking for a vbscript minify/uglify tool, preferably online :)

Something like UglifyJS or YUI Compressor, but for vbscript.
The only tool I could find is this one, but it's said to contain malware (example malware analysis) so i'd prefer an online alternative.

(I know vbscript is lame, but it's a requirement)

Any suggestions?

I want upload image after resizing on Browser with angular js

I got resized image on browser canvas by javascript.
And I can upload my image to AWS S3 directly from browser.

But the uploaded file is not an image, and I can't see it what I could on browser before uploading.

In process of resizing, I Use 'canvas.toDataURL();' and I put it to target img element's src.
The value of src is 'data:image/png;base64,iVBOR....'.
I think this value should be changed before uploading.

How can I convert it to proper format?

Basic CSS Help - Removing a shape

I'm trying to disable the triangles above the element labels via css. To view these, press a link, (hear, see, savor) There is dotted line and text. On the text there is a little red triangle/arrow that is not centered.I have done it successfully for the menus, but not the element labels. The website in question is: tedmartinez.com

.content-title span:before {
display: none;
}

.content-title span:before {

     content: none;

}

span.content-title {
    display:none;
}
span {
    display:none;
}

.content-title span:before {
    content: none;
}
#content-title span:before {
    content: none;
}

This code above does not work for disabling it on the element/content titles.

/*removing all arrows and triangles from Tripod*/
nav.main-menu > ul > li.selected:before, nav.main-menu > ul > li.active:before {
content: none;
}

nav.main-menu>ul>li:last-child:after{
content: none;
}

.sf-menu > li:hover > ul:before,
.sf-menu > li.sfHover > ul:before {
content: none;
}

nav.main-menu > ul > li:before {
    content: none;
}

.widget h5.widget-title span:before {
    content: none;
}

#reply-title span:before, #comments-title span:before, .related-title span:before {
    content: none;
}
/*tripod menu arrows while active*/
    nav.main-menu > ul > li.selected:before, nav.main-menu > ul > li.active:before {
            content: none;}

/*tripod menu arrows while hover*/
    nav.main-menu > ul.sf-menu li:hover:before, nav.main-menu > ul.sf-menu li.sfHover:before{
            content: none;}

This worked for disabling it on the menu.

That doesn't work. When I edit the HTML, just under inspect element in my browser, if I delete the span tags it works. Also, I want to center the text for the element labels. Go to the savor page to see. I want the savor to be on one line, and then a moment to be on the other, while remaining center. How can I do so? Thank you so much!

How to get two HTML buttons spaced horizontally

I need to get two HTML buttons horizontally with about 10/15 pixels space between them in the top right corner of the screen.

I tried many attempts but to no avail.

Can someone help?

Thanks

C#/Html Survey Quiz Logic

I had to change the tags used for question answers to 's since we wanted the entire area to be clickable. As I understand, this means that the value that we used to assign to the inputs can no longer be retrieved with Request.Form[]. So, i instead set up onclick html methods for each question that submits the questions value in the function like this:

<div id="Question1" style="display:normal;">
<p class="QuizQuestion">Question text......</p>
<p>
    <button class="QuizButton" type="button" name="Q1" value="1" onclick="ShowHide('Question1', 'Question2'), Q1Log(1);" > Answer1 Text..</button>
</p>

    <p><button class="QuizButton" type="button" name="Q1" value="2" onclick="ShowHide('Question1', 'Question2'), Q1Log(2);" >Answer2 Text.....</button>
</p>

At the bottom of my page I have the hiddent field that will contain the answer value:

My Javascript is this:

<script type="text/javascript">
function Q1log(Answer) {
        document.getElementById(Answer1) = Answer;
}
</script>

And then I try to retreive this Javascript variable when I call the results function when the submit button is pressed:

public string Results(string Answer1)
{
    if (Answer1== "1")
    {
       AnswerTally++;
    }
}

This isn't working and the tallies remain at their initial values. Can anyone suggest an improvement? The buttons need to be entirely clickable while still being able to contain the css class with the text inside of the button.

Images not displaying correctly in my wordpress website

I have a question regarding this post on my website: http://ift.tt/1U1vlOF. The problem is I used to insert images in my posts using the tag in my the text tab. The Mila Kunis picture is the only one i added using the 'add media' button. The problem is, it is now appearing twice in the post. The image shows perfectly where i inserted it but it also appears before all the content. I need to show only one image. Help is greatly appreciated. Thank you.

Calculate php mysql results sum dynamically

I have a table with product price model cost stock etc, to make it easier I calculate the total customer pay for for each product like this

<?php echo number_format($show['quantity'] * $show['product_price'],0,',','.'); ?>

I need to show the total sum of this calculation but as you can see they are calculared in PHP real time. Is there a way to do it?

Here is the complete code

<?php
$result=mysqli_query($database,"SELECT * FROM `products` order by `category` ASC");
$rows=mysqli_num_rows($result);
if(mysqli_num_rows($result)>0){
?>

<table class="sales">

<tr>
<td>Quantity</td>
<td>Product Cost</td>
<td>Customer Pays</td>
</tr>        

<?php if($rows){$i=0;while($show=mysqli_fetch_assoc($result)){?>

<tr>
<td><?php echo number_format($show['quantity'],0,',','.'); ?></td>
<td><?php echo number_format($show['product_cost'],0,',','.'); ?></td>
<td><?php echo number_format($show['quantity'] * $show['product_cost'],0,',','.'); ?></td>
</tr>

<?php }}?>
</table>

TOTAL CUSTOMER PAY FOR ALL PRODUCTS = EXAMPLE $10.234

<?php }else{?> 

No products to show

<?php }?>

Showing suggestions for attributes within a function (JavaScript)

So this is sort of hard to word but I am going to try my best to make this understandable :)

I am making a command driven personal assistant (in extremly early stages of development) which basically the user can type in different commands or questions and the assistant will answer the question or complete the task. For example, if a user types into the textbox "What is the time?" a dialog will appear and it will contain the time within the dialog. So what I want is when a user types in (for example) "what" it will suggest "what is the time" because that is one of the attributes within the function (you will understand when I post the code).

Here is the javascript (sorry for the mess):

// JavaScript Document

function searchKeyPress(e){
        e = e || window.event;
        if (e.keyCode == 13){
            document.getElementById('btn').click();
        }
}
function command() {
    var srchVar = document.getElementById("srch");
    var srch = srchVar.value;
    var expression = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
    var regex = new RegExp(expression);
    var t = srch;

    if(srch == '') { alert('Please do not leave the field empty!'); }

    else if(srch.indexOf('about') != -1) { alert('The function of this project is to complete simple tasks and sometimes answer simple questions. \n\nMade by Omar Latreche. \n\n(c) Copyright Omar Latreche 2015'); }

    else if(srch.indexOf('commands') != -1) { window.location = "commands.html"; }

    else if(srch.indexOf('time') != -1) { alert('The current time according to your computer is' + ShowTime(new Date())); }

    else if(srch.indexOf('what') != -1) { if (confirm('I can see that is a question. Would you like to search Google for the answer?') == true) { window.open('http://ift.tt/1j936uB' + srch, '_blank'); }
    else { /* Nothing */ }; }

    else if(srch.indexOf('when') != -1) { if (confirm('I can see that is a question. Would you like to search Google for the answer?') == true) { window.open('http://ift.tt/1j936uB' + srch, '_blank'); }
    else { /* Nothing */ }; }

    else if(srch.indexOf('where') != -1) { if (confirm('I can see that is a question. Would you like to search Google for the answer?') == true) { window.open('http://ift.tt/1j936uB' + srch, '_blank'); }
    else { /* Nothing */ }; }

    else if(srch.indexOf('why') != -1) { if (confirm('I can see that is a question. Would you like to search Google for the answer?') == true) { window.open('http://ift.tt/1j936uB' + srch, '_blank'); }
    else { /* Nothing */ }; }

    else if(srch.indexOf('how') != -1) { if (confirm('I can see that is a question. Would you like to search Google for the answer?') == true) { window.open('http://ift.tt/1j936uB' + srch, '_blank'); }
    else { /* Nothing */ }; }

    else if(srch.indexOf('who') != -1) { if (confirm('I can see that is a question. Would you like to search Google for the answer?') == true) { window.open('http://ift.tt/1j936uB' + srch, '_blank'); }
    else { /* Nothing */ }; }

    else if(srch.indexOf('?') != -1) { if (confirm('I can see that is a question. Would you like to search Google for the answer?') == true) { window.open('http://ift.tt/1j936uB' + srch, '_blank'); }
    else { /* Nothing */ }; }

    else if(srch === 'okay assistant') { alert('Hello! How can I help you?'); }

    else if(srch.indexOf('weather') != -1) { window.open('http://ift.tt/1ezzQ1d', '_blank'); }

    else if(t.match(regex)) { window.open(srch, '_blank'); }

    else { if (confirm('I am sorry but I do not understand that command. Would you like to search Google for that command?') == true) { window.open('http://ift.tt/1j936uB' + srch, '_blank'); }
        else { /* Nothing */ }
    }
}
//Show time in 12hour format
var ShowTime = (function () {
    function addZero(num) {
        return (num >= 0 && num < 10) ? "0" + num : num + "";
    }

    return function (dt) {
        var formatted = '';

        if (dt) {
            var hours24 = dt.getHours();
            var hours = ((hours24 + 11) % 12) + 1;
            formatted = [formatted, [addZero(hours), addZero(dt.getMinutes())].join(":"), hours24 > 11 ? "PM" : "AM"].join(" ");            
        }
        return formatted;
    }
})();

Here is the HTML:

<!DOCTYPE html>
<html>
<head>
<title>Tiny Assistant</title>
<script type="text/javascript" src="script.js"></script>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="cont_title">
    <span class="title">Tiny</span><span class="title2"> Assistant</span>
</div>
<div class="cont">
    <input name="srch" id="srch" class="search" spellcheck="false" onkeypress="searchKeyPress(event);" placeholder="Type &quot;Okay Assistant&quot;" type="text" />
</div>
<div style="margin-top:10px" class="cont">
    <!--<input type="submit" onClick="command();" class="button" value="Done" id="btn" />-->
    <button type="submit" id="btn" aria-label="Done" class="button" onClick="command();">
        <span class="btn_txt">Done</span>
    </button>
</div>
<div style="margin-top:10px" class="cont">
    <span class="info">&copy; Copyright Omar Latreche 2015. All rights reserved.</span>
</div>
</body>
</html>

I am sorry for the essay but that is the only way I could think to word it. I hope you understand what I'm trying to say.

Title tag inside option (chrome)

I've searched a quite a bit but haven't found a soulution yet.

It seems that chrome doesn't recognize the "alt" or "title" attribute inside an option tag, the problem can be reproduced on Chrome for windows (43.0.25357.130m) This doesn't seems to affect IE nor firefox. Is there any alternative way to show a tooltip or am i doing something wrong?

fiddle: http://ift.tt/1KpDQQU

<select >
<option alt="Testing" title="Testing">lelel</option>
    <option alt="Testing" title="Tesfdting">le5lel</option>
    <option alt="Tesdting" title="Teasdfsting">le4lel</option>
    <option alt="Tedfsting" title="Teasdsting">le23lel</option>
    <option alt="Tesgating" title="Tesdfsting">lel1el</option>
</select>

Bootstrap - Place image anywhere

I want this page www.spotin.dk to be like the image that I have linked to. I want to place an image, in the side, and some texts above that, and then I want these two items to dissapear on smaller screens. How do I do that?

It's made with Bootstrap

How do I implement external js file in html webpage?

I created the following JS in an external file:

var n = Math.floor((Math.random() * 1000) + 1); { window.alert(n);
if (n) var output = ""; if (n % 3 == 0) output += "Rock"; if (n % 5 == 0) output += "star"; window.alert(output || n); }

I want to implement this code when a person clicks a button on the webpage.

Would I use need to place this into my html page: Click me?

Responsive width css triangle with gradient

I'm trying to build a triangle with a gradient that is 100% width of it's parent. The parent element will be in a row of three columns and will be responsive. I did the the gradient part by making a solid color triangle and putting a transparent gradient over the top of it. The problem is that with this method I need to put a specific number for the width of the triangle. This is the method I'm using for the triangle

width: 0;
height: 0;
border-style: solid;
border-width: 0 0 40px 300px;
border-color: transparent transparent red transparent;

I have not been able to find a way to make the triangle be 100% width of the parent container.

The end goal will be that the triangle will have a variant height, depending on which product is being looked at, but will always be 100% width of the parent container. This is an example of what my set up is like so far.

http://ift.tt/1SYKyi3

Orderby weighted average in angular

I am trying to sort a table by a weighted average of two columns. The weights for the columns are stored in a controller's scope. When I try to refer to these weights in my orderBy expression sorting is not done correctly.

 <tr ng-repeat = "x in fruitdata | orderBy:'cost.apples*apples + cost.oranges * oranges'">

Fiddle of what I want: http://ift.tt/1SYKxdZ

If I hard code weights instead everything works as it should

 <tr ng-repeat = "x in fruitdata | orderBy:'1.89*apples + 1.49 * oranges'">

Fiddle with hard coded weights (not what I want): http://ift.tt/1KpDQQI

Overflow issue with vertically centered popup with vertical-align

I'm trying to create a popup in my application and I need to center it vertically. I do NOT know the height of the popup, so I can't hard-code any values.

I'm experimenting with the following code: Centering in the Unknown

So far the centering works fine, but there is a problem. My popups have a fixed width(and they are not responsive), so my goal is when the width of window is lower than popup's width, a horizontal scroolbar should appear.

On higher resolution the centering works fine:

enter image description here

But when window resolution is lower than popup resolution, this happens: (The actual popup is moved under viewport)

enter image description here

HTML:

<div class="block">
    <div class="centered">
        <h1>Some text</h1>
        <p>But he stole up to us again, and suddenly clapping his hand on my shoulder, said&mdash;"Did ye see anything looking like men going towards that ship a while ago?"</p>
    </div>
</div>

CSS

.block {
  text-align: center;
  background: #c0c0c0;
  border: #a0a0a0 solid 1px;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
}

.block:before {
  content: '';
  display: inline-block;
  height: 100%; 
  vertical-align: middle;
 }

.centered {
  display: inline-block;
  vertical-align: middle;
  width: 500px;
  padding: 10px 15px;
  border: #a0a0a0 solid 1px;
  background: #f5f5f5;
 }

How to pass uploaded pdf file to the variable. (PDF.JS)

Reference : http://ift.tt/1qXLat4

In this project developer has taken a pdf as input and pass it to variable "input". I want to create an upload menu/dropzone so that anyone can upload their pdf and it automatically get passed to the variable "input" and text can be extracted. I am able to upload the file but don't know how to pass that pdf to the variable "input".

<body>
    <form id="upload" method="post" action="upload.php" enctype="multipart/form-data">
          <div id="drop">
            Drop Here
                <a>Browse</a>
            <input id="inputx" src="./"type="file" name="upl" multiple />
          </div>

          <ul>
            <!-- The file uploads will be shown here -->
          </ul>

        </form>

Now using this form a pdf will be uploaded now we have to pass it the variable "input ".

          <script>     
          var input = document.getElementById("input");
          var processor = document.getElementById("processor");
          var output = document.getElementById("output");

          window.addEventListener("message", function(event){
            if (event.source != processor.contentWindow) return;

            switch (event.data){
              case "ready":
                var xhr = new XMLHttpRequest;
                xhr.open('GET', input.getAttribute("src"), true);
                xhr.responseType = "arraybuffer";

                xhr.onload = function(event) {
                  processor.contentWindow.postMessage(this.response, "*");
                };

                xhr.send();

              break;

              default:
                 output.innerHTML = event.data.replace(/\s+/g, " ");
                break;
            }
          }, true);
          </script>
    </body>

bootstrap reduce spacing between rows

Bootstrap 3.3.5

I'm trying to reduce the amount of spacing between rows:

enter image description here

Ive tried adding removing margins & padding on the row but doesnt seem to change anything:

<div class="row" style="margin-top: 0px !important; margin-bottom: 0px !important; border: solid 1px red; padding-top: 0px !important; padding-bottom: 0px !important;">

These are the possible solutions to remove the spacing but doesnt seem to work for me.

Here is the code:

<div class="container-fluid">


    <div class="row" style=" border: solid 1px red; overflow: hidden; ">
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6"></div>

        <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-right">

            <form class="form-horizontal">
                <div class="form-group" style="">
                    <label
                    class="col-xs-8 col-sm-8 col-md-8 col-lg-8 control-label" 
                    style="font-size: .8em;">Start Total:&nbsp;</label>

                    <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 text-left" style="margin: 0; padding: 0;">
                        <input type="text" class="form-control input-sm text-left" id="startCount" readonly="readonly" style="">
                    </div>
                </div>
            </form>

        </div>

        <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-left ">
            <form class="form-horizontal">
                <div class="form-group">
                    <label
                    class="col-xs-8 col-sm-8 col-md-8 col-lg-8 control-label" 
                    style="font-size: .8em;">Inmate Total:&nbsp;</label>

                    <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 text-left" style="margin: 0; padding: 0;">
                        <input type="text" class="form-control input-sm text-left" id="total" readonly="readonly" style="">
                    </div>
                </div>                  

            </form>
        </div>

        <div class="clearfix"></div>

    </div>

    <div class="row" style="">
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6"></div>

        <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-right">

            <form class="form-horizontal">
                <div class="form-group" style="">
                    <label
                    class="col-xs-8 col-sm-8 col-md-8 col-lg-8 control-label" 
                    style="font-size: .8em;">Booked:&nbsp;</label>

                    <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 text-left" style="margin: 0; padding: 0;">
                        <input type="text" class="form-control input-sm text-left" id="book" readonly="readonly">
                    </div>
                </div>
            </form>

        </div>


        <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-left">

            <form class="form-horizontal">
                <div class="form-group" style="">
                    <label
                    class="col-xs-8 col-sm-8 col-md-8 col-lg-8 control-label" 
                    style="font-size: .8em;">Out House:&nbsp;</label>

                    <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 text-left" style="margin: 0; padding: 0;">
                        <input type="text" class="form-control input-sm text-left" id="house" readonly="readonly">
                    </div>
                </div>
            </form>

        </div>




        <div class="clearfix"></div>

    </div>

</div>

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data on my Image Uploader

Im new here and did not find out my Solution by using Google or StackOverflow.
My Problem is that i have a Multiple Image Uploader that works with JSON, AJAX and PHP... But while I am programming, i get this Message on the Firefox Console:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Witch is related to this line:

ajax = function (data) {
    var xml = new XMLHttpRequest(), uploaded;
    xml.addEventListener("readystatechange", function() {
        if(this.readyState === 4) {
            if(this.status === 200) {
                uploaded = JSON.parse(this.response); //THIS IS THE ERROR LINE
                if(typeof o.options.finished === "function") {
                    o.options.finished(uploaded);
                }
            }else {
                if(typeof o.options.error === "function") {
                    o.options.error();
                }
            }
        }
    });

I think its because the Array in the Variable "Uploaded" is empty... But it shouldve be filled so far.. Well, here is the PHP Code:

header("Content-Type: application/json");

$uploaded = [];
$allowed = ["mp4", "jpg", "png", "jpeg", "doc", "avi"];

$files = $_FILES["file"];

$succedeed = [];
$failed = [];

if (!empty($files)) {
    foreach($files["name"] as $key => $name) {
        if($files["error"][$key] === 0) {

            $temp = $files["tmp_name"][$key];

            $ext = explode(".", $name);
            $ext = strtolower(end($ext));

            $file = $files["tmp_name"][$key] . $ext;


            if(in_array($ext, $allowed) === true && move_uploaded_file($temp, "uploads/{$file}") === true) {
                $succedeed[] = array(
                    "Original Name" => $name,
                    "MD5 Name" => $file
                );
            }else {
                $failed[] = array(
                    "Original Name" => $name
                );

            }   
        }
    }

    if(!empty($_POST["ajax"])) {
        echo json_encode(array(
            "Erfolgreich hochgeladen" => $succedeed,
            "Nicht erfolgreich hochgeladen" => $failed
        ));
    }


}

Im very Desperated because of this... :D Hope someone can Help me... ^^

Niggo

How do I call a function when going back to a page with javascript?

So I'm having problems trying to figure out how to call a function when I am going back to a page, maybe you guys can help me. In my bossHandler file I have it for when the boss's HP reaches 0, it calls back to my storyPage.html file and continues where the story left off. This is what I have.

bossHandler.js

if(currMonster.currHp <= 0) {
    currMonster.currHp = 0;
    alert("You have killed " + currMonster.name + "! \n You gained " + currMonster.gold + " gold!!!")
    myChar.gold += currMonster.gold;
    updateCookie(myChar);
    loadPageWithNumber(17);
}

On my storyPage.js I have

function loadPageWithNumber(pageNumber){
    window.location ="storyPage.html";
    nextStoryText(pageNumber);
}

but the problem I am getting is that it is calling nextStoryText() before the new page has loaded. I've tried a few things and also tried changing the page back in the if statment and then calling nextStoryText() from my bossHandler.js file and that still didn't work. Tried looking around on here for a solution but I kept finding ways to just go back to the page and call an onload event, but I don't want a event to fire every time I load that page. Is there a easy way to do this?

Also, my storyPage.html is the first page I'm on until an encounter starts, then it heads to my bossPage.html. Once the boss is dead I want to go BACK to storyPage.html and that's the problem I'm having currently.

Thanks in advance.

Div does not show the css

I don't find my problem:

body {
  position: relative;
}
#content {
  position: relative;
}
#overlay {
  position: absolute;
  z-index: 10;
  width: 500px;
  height: 150px;
  top: 215px;
}
#callAction {
  position: absolute;
  z-index: 1;
  display: inline-block;
  padding: 38px 110px;
}
<div id="content">
  <div id="overlay">
    <a id="callAction">Button<a>
        </div>
    </div>

The CSS of the a-tag works, but not the css of the div-tag with the id #overlay. What is the problem here??

Client side form validation for Copy/Pastes via Right-Click

I'm using the following line (Struts1 syntax) to display a text field and allow some client side checks via Javascript.

<html:text styleId="myField" property="myProperty" onkeyup="function()" />

My intention is for a message to appear and a dropdown to disable whenever there is text entered into the form field (regardless of content). The onkeyup attribute works fine for all cases except for when the user pastes in text using mouse right-click.

It doesn't appear that onmousedown and onmouseup events notice right clicks. The same goes for onfocus.

onchange only makes the check when focus is lost, however the user can circumvent this by pasting data and clicking the form submit (same for onblur).

onmouseout somewhat works (I can break functionality) in IE8, but doesn't work at all in Chrome v41.0.2272.89

Has anyone encountered client-side form checks on Mouse-Right Click? I'd like to cover this use case across browsers and cannot count on the end user to always paste via keyboard shortcuts.

How to create an div background that is not affected by page zoom with CSS

My question is going to be pretty concise. I saw this Deezer page and I tried to zoom in and out to see that the image is "out of zoom" (see the image below)

enter image description here

Below is a structure we consider to be my page:

<body>
  <div class="visual-header">
    <div class="container">
       SOME TEXT
    </div>
  </div>
  PAGE CONTENT
</body>

How am I supposed to use image.png of a size of 2000x800 pixels to get this effect?

How to output multiple fields to a single page

I am looking to output text from multiple fields to a single page so that I can just copy and paste it. I made a basic HTML document with fields and I just want to hit submit and have it output all of the information condensed into one page all together. This is what I have

<style>
form {
  padding-top: 30px;
  min-width: 458px;
  > div,
  > fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 8px 0;
    clear: both;
  }
  label,
  legend {
    float: left;
    width: 50px;
    padding: 7px 10px;
    &.radio-label {
      float: none;
      padding: 0;
    }
  }
  .choice-group {
    padding: 7px 10px 0 10px;
  }
  input[type=checkbox],
  input[type=radio] {
    margin-right: 20px;
  }
  input[type=text],
  input[type=email],
  input[type=password],
  input[type=number],
  textarea {
    width: 200px;
    border: 1px solid darken(tan, 20%);
    padding: 7px 10px;
    border-radius: 4px;
    outline: 0;
    &:focus {
      border-color: black;
    }
    &.short {
      width: 60px;
    }
    &.medium {
      width: 150px;
    }
    &.very-short {
      width: 40px;
    }
    &.long {
      width: 300px;
    }
  }
}

.screen-reader {
  position: absolute;
  top: -9999px;
  left: -9999px;
}

body {
  background: #E27C37;
  padding: 20px;
  font-size: small;
}
</style>
<h1>Prefill Machine</h1>

<form action="#0" id="form">

  <div>
    <label for="name">Name</label>
    <input type="text" name="name" id="name" placeholder="Digby Coyier" required>
  </div>

  <div>
    <label for="email">Email</label>
    <input type="email" name="email" id="email" placeholder="digby@digby.com" required>
  </div>

  <div>
    <label for="name">Username</label>
    <input type="text" name="username" id="username" placeholder="digby2007" required>
  </div>

  <div>
    <label for="name">Password</label>
    <input type="password" name="pw" id="pw" required>
  </div>

  <div>
    <label for="name">Repeat</label>
    <input type="password" name="pw-repeat" id="pw-repeat" required>
  </div>


  <fieldset>
    <legend>Radio Choice</legend>

    <div class="choice-group">
      <label class="radio-label" for="radio-choice-1">Choice 1</label>
      <input type="radio" name="radio-choice" id="radio-choice-1" value="choice-1" />

      <label class="radio-label" for="radio-choice-2">Choice 2</label>
      <input type="radio" name="radio-choice" id="radio-choice-2" value="choice-2" />
    </div>
  </fieldset>

  <div>
    <label for="select-choice">Select Choice</label>
    <div class="choice-group">
      <select name="select-choice" id="select-choice">
        <option value="Choice 1">Choice 1</option>
        <option value="Choice 2">Choice 2</option>
        <option value="Choice 3">Choice 3</option>
      </select>
    </div>
  </div>

  <div>
    <label for="message">Message</label>
    <textarea cols="40" rows="8" name="message" id="message"></textarea>
  </div>

  <div>
    <label for="cc">Credit Card #</label>
    <input type="text" name="cc" id="cc" placeholder="4242 4242 4242 4242" required>
  </div>

  <div>
    <label for="exp-1">Expiration <span class="screen-reader">Month</span></label>
    <input class="very-short" type="number" name="exp-1" id="exp-1" placeholder="08" min="1" max="12">
    <label for="exp-2" class="screen-reader">Expiration Year</label>
    <input type="number" name="exp-2" class="very-short" id="exp-2" placeholder="16" min="14">
  </div>

  <div>
    <label for="exp-1">CVV</label>
    <input class="short" type="text" name="cvv" id="cvv" placeholder="123">
  </div>

  <div>
    <label for="name">Address</label>
    <input type="text" class="long" name="address" id="address" placeholder="123 Super Street">
  </div>

  <div>
    <label for="city">&nbsp;<span class="screen-reader">City<span></label>
    <input type="text" name="city" id="city" class="medium"  placeholder="Milwaukee">
    <label for="state" class="screen-reader">State</label>
    <input type="text" name="state" class="very-short" id="state" placeholder="WI">
    <label for="zip" class="screen-reader">Zip</label>
    <input type="text" name="zip" class="short" id="zip" placeholder="55555" pattern="(\d{5}([\-]\d{4})?)" required>
  </div>

  <div>
    <label for="agree-terms">Agree?</label>
    <div class="choice-group">
      <input type="checkbox" name="agree-terms" id="agree-terms">
    </div>
  </div>

  <div>
    <input type="submit" value="Submit" id="submit-button">
  </div>
</form>

I want the page to fill in everything when I click submit so I will look like the following:

Name: John Smith
Email: John.Smith@mail.com
USERNAME: JSMith
Password:123456
Choice 1

And so on

This way I can just copy and paste it all into an email or a text file.

Fix thead on the top of all page

I am trying to table print using by CSS @media print.I search this type of case every where, I found similar type of solution but it can't work.

Currently I am using Google chrome version 43.0 and FireFox 38.0.5, FireFox is repeat the thead in every pages and arranging tr lines automatically, but chorme not working on the same case.

Is it possible to print using by CSS @media print? I hope you understand what I mean and your kindly suggestion.

Click here to view code

Photoviewer Switching between divs

http://ift.tt/1Lyw5Hs

Hi all,

I have created a gallery of pictures which you cannot see with Jfiddle but all the code is there. I am attempting to have it so each time you click on an image one paragraph disappears and another emerges. The way I coded it works with one problem. If i click anywhere on the screen other than another image the paragraph disappears and another will not appear until I click an image. How can I code it so that the paragraphs will hide only if I click on one of the images and not if I click elsewhere as well. Thank you for your help!

Java:

        var request;
    var $current;
    var cache = {};
    var $frame = $('#photo-viewer');
    var $thumbs = $('.thumb');

    function crossfade($img) {

        if ($current) {
            $current.stop().fadeOut('slow');
        }

        $img.css({
            marginLeft: -$img.width() / 2,
            marginTop: -$img.height() / 2
        });

        $img.stop().fadeTo('slow', 1);

        $current = $img;
    };

    $(document).on('click', '.thumb', function(e){
        var $img;
        var src = this.href;
        request = src;

        e.preventDefault();

        $thumbs.removeClass('active');
        $(this).addClass('active');

        if(cache.hasOwnProperty(src)) {
            if (cache[src].isLoading === false) {
                crossfade(cache[src].$img);
        }
    } else {
        $img = $('<img/>');
        cache[src] = {
            $img: $img,
            isLoading: true
        };

        $img.on('load', function() {
            $img.hide();
            $frame.removeClass('is-loading').append($img);
            cache[src].isLoading = false;
            if(request === src) {
                crossfade($img);
            }
        });

        $frame.addClass('is-loading');

        $img.attr({
            'src': src,
            'alt': this.title || ' ' 
        });
    }
    });

    $(document).mouseup(function(e) {
        var container = $("#mad");
        jQuery("#para").hide();
        //toggle the componenet with class msg_body
        jQuery("#mad").click(function() {
            $(this).next($("#para").fadeIn(500))
            if (!container.is(e.target) // if the target of the click isn't the container...
            && container.has(e.target).length === 0) // ... nor a descendant of the container
        {
            $("#para").hide();
        }

    })
    });
    $(document).mouseup(function(e) {
        var container = $("#ralph");
        jQuery("#para2").hide();
        //toggle the componenet with class msg_body
        jQuery("#ralph").click(function() {
            $(this).next($("#para2").fadeIn(500))
            if (!container.is(e.target) // if the target of the click isn't the container...
            && container.has(e.target).length === 0) // ... nor a descendant of the container
        {
            $("#para2").hide();
        }

    })
    });
    $(document).mouseup(function(e) {
        var container = $("#julia");
        jQuery("#para3").hide();
        //toggle the componenet with class msg_body
        jQuery("#julia").click(function() {
            $(this).next($("#para3").fadeIn(500))
            if (!container.is(e.target) // if the target of the click isn't the container...
            && container.has(e.target).length === 0) // ... nor a descendant of the container
        {
            $("#para3").hide();
        }

    })
    });
    $(document).mouseup(function(e) {
        var container = $("#sophie");
        jQuery("#para4").hide();
        //toggle the componenet with class msg_body
        jQuery("#sophie").click(function() {
            $(this).next($("#para4").fadeIn(500))
            if (!container.is(e.target) // if the target of the click isn't the container...
            && container.has(e.target).length === 0) // ... nor a descendant of the container
        {
            $("#para4").hide();
        }

    })
    });
    $(document).mouseup(function(e) {
        var container = $("#may");
        jQuery("#para5").hide();
        //toggle the componenet with class msg_body
        jQuery("#may").click(function() {
            $(this).next($("#para5").fadeIn(500))
            if (!container.is(e.target) // if the target of the click isn't the container...
            && container.has(e.target).length === 0) // ... nor a descendant of the container
        {
            $("#para5").hide();
        }

    })
    });
    $(document).mouseup(function(e) {
        var container = $("#kiss");
        jQuery("#para6").hide();
        //toggle the componenet with class msg_body
        jQuery("#kiss").click(function() {
            $(this).next($("#para6").fadeIn(500))
            if (!container.is(e.target) // if the target of the click isn't the container...
            && container.has(e.target).length === 0) // ... nor a descendant of the container
        {
            $("#para6").hide();
        }

    })
    });
    $('.thumb').eq(0).click();

HTML



     <!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="Gallerystyle.css">
<ul class="navigation">
    <p> Nicholas Clegg </p>
  <li><a href="painthome.html">Home</a></li>
  <li><a href=favart.html>Artists</a></li>
  <li><a href="#">Sale</a></li>
  <li><a href="contact.html">Contact</a></li>
</ul>
</head>
<body>

        <div id="photo-viewer">  
<p id="para"> <em> "Maddy" </em> <br>
    <span class="normal">This is a picture of Nicholas'   <br>
                         niece. Her innocence and utter <br>
                         adorableness inspired Nick to <br>
                         draw this beautiful portrait <br>
                         of a young lady early in <br>
                         her life.</span></p>
<p id="para2"> <em> "Raplhie" </em> <br>
    <span class="normal">This is a picture of Nicholas'   <br>
                         grandfather. Nick captures the <br>
                         joy of ageing by encapsulating <br>
                         every detail of an older man  <br>
                         still in the prime of his life.</span></p> 
<p id="para3"> <em> "Julia" </em> <br>
    <span class="normal">This is a picture of Nicholas'   <br>
                         grandfather. Nick captures the <br>
                         joy of ageing by encapsulating <br>
                         every detail of an older man  <br>
                         still in the prime of his life.</span></p> 
<p id="para4"> <em> "Sophie" </em> <br>
    <span class="normal">This is a picture of Nicholas'   <br>
                         grandfather. Nick captures the <br>
                         joy of ageing by encapsulating <br>
                         every detail of an older man  <br>
                         still in the prime of his life.</span></p> 
<p id="para5"> <em> "Unknown" </em> <br>
    <span class="normal">This is a picture of Nicholas'   <br>
                         grandfather. Nick captures the <br>
                         joy of ageing by encapsulating <br>
                         every detail of an older man  <br>
                         still in the prime of his life.</span></p> 
<p id="para6"> <em> "Jo and Rich" </em> <br>
    <span class="normal">This is a picture of Nicholas'   <br>
                         grandfather. Nick captures the <br>
                         joy of ageing by encapsulating <br>
                         every detail of an older man  <br>
                         still in the prime of his life.</span></p> 
    </div>
        <div id="thumbnails">

        <a id ="mad" href="img/madeline.jpg" class ="thumb active" title="Madeline">
        <img id ="mad" src="img/madelinethumb.jpg" alt="Madeline" /></a>

        <a id="ralph" href="img/ralph.jpg"  title="Ralph" class="thumb">
        <img id="ralph" src="img/ralphthumb.jpg" alt="Ralph" /></a>

        <a id="julia" href="img/julia.jpg"  title="Julia" class="thumb">
        <img id="julia" src="img/juliathumb.jpg" alt="Julia" /></a>

        <a id="sophie" href="img/sophie.jpg"  title="Julia" class="thumb">
        <img id="sophie" src="img/sophiethumb.jpg" alt="Julia" /></a>

        <a id="may" href="img/may.jpg"  title="Julia" class="thumb">
        <img id="may" src="img/maythumb.jpg" alt="May" /></a>

        <a id="kiss" href="img/kiss.jpg"  title="Julia" class="thumb">
        <img id="kiss" src="img/kissthumb.jpg" alt="Joanna and Rich" /></a>
    </div>
<script  src='jquery-1.11.2.min.js'> </script>
<script src='photo-viewer2.js'> </script>

</body>
</html>

Files published using html, JavaScript, not loading locally

We have a series of eLearning courses that were developed with Lectora and published for web. Unfortunately, the Lectora source files are lost. All we have are the index file, attendant .js files, and supporting documentation files.

The courses load ready when the index.html files are executed over the network, but not when they are copied to a local machine. There is no error. The window simply says "Loading , please wait".

Is there something I can change in the .html or .js files to enable local loading?

CODE FOR INDEX.HTML FILE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!--GENERATED BY:  Lectora Professional Publishing Suite v.9.3(6345) (http://ift.tt/1DmtkSt) -->


<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Bear Aware</title>

<script language = "JavaScript" src="trivantis.js"></script>
<script language = "JavaScript" src="trivantis-cookie.js"></script>
<script language = "JavaScript">

<!-- 
if( is.ieMac )
  document.write( '<font size=4>(Note: Internet Explorer for the Macintosh does not support JavaScript access to applets/AJAX. This is a browser limitation, not a shortcoming of the course material. For this reason, Macintosh IE 5 users cannot access course materials incorporating JavaScript/AJAX functions. Please try accessing this course material from a non-Macintosh machine or a non-IE browser on the Macintosh.</font><br /><br />' )
else if( !is.min )
  document.write( 'Your browser does not support dynamic html. Please download a current version of either <a href="http://ift.tt/1jENylb">Microsoft Internet Explorer</a> or <a href="http://ift.tt/v6AY4F">Mozilla Firefox </a> and try visiting our site again.  Thank You.<br /><br />' )

var winW = screen.width
var winH = screen.height

function findWH() {
    winW = (is.ns)? window.innerWidth-16 : document.body.offsetWidth-20
    winH = (is.ns)? window.innerHeight   : document.body.offsetHeight
}

function ReFlow() {
}

onload = init

function init() {
  findWH()
}
// -->

</script>
</head>

<frameset rows="0,*" border="0" frameborder="0" framespacing="0"  onResize="ReFlow()">
  <frame name="titlemgrframe" src="titlemgr.html" resize="no" scrolling='no' marginwidth='0' marginheight='0' />
  <frame name="contentframe" src="content.html" resize="no" />
  <noframes>
    <body>
      <p>Your browser does not support frames</p>
    </body>
  </noframes>
</frameset>
</html>

CODE FOR JS FILE

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Bear Aware</title>

<script language = "JavaScript" src="trivantis.js"></script>
<script language = "JavaScript" src="trivantis-cookie.js"></script>
<script language = "JavaScript">

<!-- 
if( is.ieMac )
  document.write( '<font size=4>(Note: Internet Explorer for the Macintosh does not support JavaScript access to applets/AJAX. This is a browser limitation, not a shortcoming of the course material. For this reason, Macintosh IE 5 users cannot access course materials incorporating JavaScript/AJAX functions. Please try accessing this course material from a non-Macintosh machine or a non-IE browser on the Macintosh.</font><br /><br />' )
else if( !is.min )
  document.write( 'Your browser does not support dynamic html. Please download a current version of either <a href="http://ift.tt/1jENylb">Microsoft Internet Explorer</a> or <a href="http://ift.tt/v6AY4F">Mozilla Firefox </a> and try visiting our site again.  Thank You.<br /><br />' )

var winW = screen.width
var winH = screen.height

function findWH() {
    winW = (is.ns)? window.innerWidth-16 : document.body.offsetWidth-20
    winH = (is.ns)? window.innerHeight   : document.body.offsetHeight
}

function ReFlow() {
}

onload = init

function init() {
  findWH()
}
// -->

</script>
</head>

<frameset rows="0,*" border="0" frameborder="0" framespacing="0"  onResize="ReFlow()">
  <frame name="titlemgrframe" src="titlemgr.html" resize="no" scrolling='no' marginwidth='0' marginheight='0' />
  <frame name="contentframe" src="content.html" resize="no" />
  <noframes>
    <body>
      <p>Your browser does not support frames</p>
    </body>
  </noframes>
</frameset>
</html>

Internet explorer not showing

Hi i'm new in web developement, i have three browsers : google Chrome , Mozilla FireFox and Internet Explorer 11, i'm creating login page, everything is ok in Google Chrome and Mozilla FireFox, where the result is like :enter image description here

but in internet explorer The result is like : enter image description here

The Html code is like :

<body>
    <center>
        <h1>Connexion</h1>
        <!-- Some PHP code -->
        <form method='post' action=''>  
            <input type="email" name="email"  placeholder="Votre email" value="<?php echo isset($email) ? $email :'';?>"> 
            <br><br> 
            <input type="password"  placeholder="Votre mot de passe" name="password"> 
            <br><br> 
            <div class="select-style">
                <select name="type" placeholder="Type de compte">
                    <?php echo isset($type) ?'<option value='.$type.'>'.$type.'</option>': '';?>
                    <?php echo $type!='Médecin' ? '<option value="Médecin">Médecin</option>' :'';?>
                    <?php echo $type!='Patient' ? '<option value="Patient">Patient</option>' :'';?>  
                </select>
            </div>
            <br><br>

            <input type="submit" value="Se connecter" name="submit">

        </form> 
        <div class="lien">
            <a href="index.php?page=registerMed">Créer un compte Médecin</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="index.php?page=register">Créer un compte Patient</a>
        </div>
    </center> 
</body>

the css is like :

@import url(http://ift.tt/1CWRsPn);

input {
    padding: 5px;
    border: 3px solid rgba(52, 152, 219, 0.6);
    border-radius: 5px;
    width: 400px;
    font-family: Raleway, Open Sans, Droid Sans;
    box-sizing: border-box;
}

input:focus {
    border-color: #2875A8;
}

input[type=submit] {
    padding: 5px 15px;
    background: rgba(52, 152, 219, 0.6);
    border: 0 none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 5px;
}

input[type=submit]:hover {
    background: #3DB7FF;
}

input[type=submit]:focus {
    background: #2875A8;
}

.error {
    padding: 10px;
    left: 0;
    top: 0;
    color: #ffffff;
    background-color: #d30000;
}

body {
    background-color: #3498db;
    font-family: Raleway, Open Sans, Droid Sans;
}

a {
    text-decoration: none;
    color: #ffffff;
    background-color: rgba(180, 180, 180, 0);
    padding: 0px 5px  0px 5px;
}

a:hover,
a:focus {
    background-color: #3DB7FF;
    padding: 0px 5px  0px 5px;
    border-radius: 5px;
}

.select-style {
    border: 3px solid  rgba(52, 152, 219, 0.6);
    border-radius: 5px;
    width: 70%;
    max-width: 70%;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    background-color: rgba(52, 152, 219, 0.6);
    background: #fff url("http://ift.tt/1C2uGqM") no-repeat 90% 50%;
}

.select-style select {
    padding: 5px 8px;
    border: 0px;
    width: 100%;
    height: 40px;
    font-family: Raleway, Open Sans, Droid Sans;
    background-color: transparent;
    background-image: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.content {
    margin-left: auto;
    margin-right: auto;
    width: 60%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
    -webkit-transition: box-shadow .3s ease;
    transition: box-shadow .3s ease;
    background-color: #f2f2f2;
    background-color: rgba(210, 210, 255, 0.6);
    margin: 50px auto;
    border-radius: 10px;
    position: relative;
}

.content form {
    padding: 30px;
}

.content form input[type=text],
input[type=email],
input[type=password] {
    height: 40px;
    margin-left: auto;
    margin-right: auto;
    width: 70%;
}

.content form input[type=submit] {
    width: 70%;
    margin-left: auto;
    margin-right: auto;
}

h1 {
    color: #ffffff;
    background: rgba(52, 152, 219, 0.6);
}

.fullBg {
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}

.lien {
    background-color: rgba(52, 152, 219, 0.6);
    border-radius: 0px 0px 10px 10px;
    padding: 5px;
}

Creating popularity bars in css/html

I'm trying to make a popularity bar like that of Spotify

enter image description here

Anyone know of any good tutorials (havn't been able to find any). Or have any code builds of their own?

Optimize logic of jQuery Code

I have a very illogical jQuery code and I want to see if someone finds a better way to do the exact same thing:

jQuery:

$(".col-md-3 img").hover(function() {
    $(this).parent().children(".search").show();
    $(this).parent().children(".photo").css("opacity","0.4");
}, function(){
    $(this).parent().children(".search").hide();
    $(this).parent().children(".photo").css("opacity","1");
});

HTLM corresponding to this code:

<div class="col-md-3">
    <img class="photo" src="img/1_small.jpg" alt="img" />
    <img class="search hidden-xs" src="img/search.png" width="50px"/> 
</div>

I have multiple similar divs.

JCanvas restrict drag-and-drop layer for only right click

I'm using JCanvas for my isometric game. How to restrict the draggable layers to work only with the right mouse button?

So I would like to drag-and-drop my layer only with the right mouse button.

My render code is:

$c.drawImage({
    layer: true,
    groups: ['terrain'],
    dragGroups: ['terrain'],
    source: 'img/tileset.png',
    x: x_pos, y: y_pos,
    sWidth: 64,
    sHeight: 32,
    sx: map[x][y]*64, sy: 0
});

Avoid HTML file cache in HTML5 manifest (appcache)

I made a little script in PHP that create a file manifest for my website scanning the directories which I give it but without include in the manifest the HTML pages and the manifest file it cache them anyway. The problem is that many part of HTML pages are dynamical written by PHP and now don't change, they remain static but the more strange things is that when I change language and the website is reloaded the page is correctly translated and the text are also written by PHP. I've seen in a guide for the manifest usage to include in .htaccess this:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/cache-manifest "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds" 
</IfModule>

The mod_expires is active and I seen website HTML index headers:

HTTP/1.1 200 OK => 
Date => Mon, 29 Jun 2015 19:13:02 GMT
Server => Apache/2.4.12 (Ubuntu)
X-Powered-By => PHP/5.6.10-1+deb.sury.org~trusty+1
Vary => Accept-Encoding
Cache-Control => max-age=1
Expires => Mon, 29 Jun 2015 19:13:03 GMT
X-Frame-Options => DENY
Connection => close
Content-Type => text/html; charset=UTF-8

So I think that the .htaccess directive is working but browser ignores it, I've tested on Chrome and Safari and also on Safari for iOS 8 but no changes. With manifest I can get a website that loads in few seconds but now ever works offline. How can I disable HTML and manifest cache? Here there is the website (beta): http://ift.tt/1CF9sdk Here there is the manifest: http://ift.tt/1C2CTLu

What's faster, to hide/show an HTML element, or to delete/insert it?

I am developing a navbar where the selected button is marked by a triangle. Do I put a triangle in every button of my navbar and keep all but one triangle invisible (or visible but same background as the button)? Or do I delete the triangle and reinsert it in the new button?

I understand the performance impact would probably be negligible, but I am learning my ropes, so mostly asking out of curiosity (and wanting to learn the best practices)

Show all data with class same as the id clicked on

I have a question about Jquery. I want to show all data with the same class as I clicked on.

i made a list of things I can click on. So when I click it, the right data should be shown. I made this but it's not working.

This is my Jquery code:

$("div span").hide();
$('input[type=checkbox]').on("change", function(e) {

    var id = $(this).attr('id'); 
    if(this.checked){
        alert("checked");
        e.preventDefault();

    }else{
        alert("not checked");
    }


});

http://ift.tt/1U1nCAn

Bootstrap: Stretching navbar-toggle button in media query

I have started making a simple website using Bootstrap. Everything works fine, but because I've put my logo in navbar-header , the button does quite funky when going under 407px (407 due to the logo size).

Currently, it is like this (>407px wide): http://ift.tt/1QZXy9C

When under 407, it looks like this: http://ift.tt/1GIvxIH

I want it to look like this: (Click the previous link, replace #1 by #2, "I don't have enough reputation...")

How would I go about doing this?

Thanks! Please let me know if you want any further details. -Jack

PHP Session: Preset login details only working locally

I am working on a website and I decided to make my own CMS for it. It doesn't need amazing security but I do have a login page for it that directs to the CMS page if the login information is correctly filled out.

It's only possible to login with 1 account (admin). And its login name and password are set within the login page PHP file. When submitting the form it checks if the right information is filled out, and if so, it puts the username within a SESSION[user] variable.

Aslong as that session exists the loginpage should always autodirect you to the CMS page, but this only seems to work locally. When i put it online, and fill out the right information and submit the form on the loginpage, it just stays on the same page instead of going to the CMS page. When i manually type in the URL of the cms page I can access it without being directed to the loginpage. And in my PHP i do check whether $_SESSION['user'] == admin.

Any of you guys have an idea why this only works locally, and what I need to change to make it work online too?

Here is the relevant code:

//LOGIN PHP PAGE

<?php
session_start();
    //login info
    $xinlognaam = 'admin';
    $xwachtwoord = 'PASSWORD HERE';

    //als je al ingelogd bent, wordt je direct naar cms pagina gestuurd
    if(!empty($_SESSION['user'])){
        if($_SESSION['user'] == $xinlognaam){
            header("Location: ../php/cms.php");
        }
    }
?>

    <div id="inlogsectie">
        <form id="inlogform" method="POST" action="#">

            Accountnaam:<br><br>
            <input type="text" name="accountnaam" id="accountnaam" maxlength="100"/><br><br><br>

            Wachtwoord:<br><br>
            <input type="text" name="wachtwoord" id="wachtwoord" maxlength="100"/><br><br><br>

            <input type="submit" name="inlogknop" id="inlogknop" value="inloggen"/>
        </form>

        <div id="inlogmelding">
            <?php
                //als op de knop gedrukt wordt
                if(isset($_POST['inlogknop'])){
                    //als velden niet leeg zijn
                    if(!empty($_POST['accountnaam']) && !empty($_POST['wachtwoord'])) {
                        //als de gegevens correct zijn
                        if(($xinlognaam == $_POST['accountnaam']) && ($xwachtwoord == $_POST['wachtwoord'])){
                            $_SESSION['user'] = $xinlognaam;
                            header("Location: ../php/cms.php");
                        //als de gegevens incorrect zijn
                        }else{
                            echo"De ingevulde login informatie is incorrect.";
                        }
                    } else{ //als velden leeg zijn
                        echo"De ingevulde login informatie is incorrect.";
                    }
                }
            ?>
        </div>
    </div>

//CMS PAGE

 <?php
  session_start();

 if($_SESSION['user'] != 'admin'){
        header('Location: ../admin/index.php');
    }

 if(isset($_POST['uitlogknop'])){
        include_once('uitloggen.php');
    }
   ?>

//LOG OUT PHP FILE

<?php
session_destroy();

header("Location: ../admin/index.php");

?>

Copying a URL of page X to a readonly text field on page Y

From a webpage www.foo.com, a user clicks a feedback hyperlink to submit feedback about something. It opens a new page with text fields to fill out. What I would like to do is get the URL of the original page www.foo.com for example, to appear in a readonly field on the new page.

This is what I currently have as my test code on my feedback page.

<input id="URL" type="text" name="pageURL" readonly> <script type="text/javascript"> document.getElementById('URL').value = document.location.href; </script>

This displays the URL of the feedback page, page Y, which is what I would expect.

But I'm drawing a blank on how I would get the url of page X, in this example, www.foo.com to appear in the readonly.

I would assume I have to do something in the code for the original page and have that carry over. I do have CORS functioning for other purposes but the information I'm using for that is being brought to a php file instead of the .htm file the form page operates on. I'm still a beginner with CORS but I wouldn't think something like a URL would require it. Or maybe this is mindblowingly simple.

Skip hidden tab indexes

I have the following html:

<span tabindex="19">

</span>

<span tabindex="20">

</span>

<span tabindex="21">

</span>

<span id="hidden" tabindex="22">

</span>

<span tabindex="23">

</span>

<span tabindex="24">

</span>

As you can see one of the span is hidden, the code to hide it is

#hidden
{
display: none;
}

I want a behavior where tab skips the hidden indexes. So i want something like this when i click tab:- go to 19,20,21,23,24

I have no way of controlling the tab indexes as they are coming hard coded in the html i process.

Vertically Center Text

I am having an issue with some CSS within my code. Using bootstrap I have created a square which is 400px height, and I would like to have text inside there which is centered vertically. I am using JavaScript to change the text when hovered, the issue here is if the text changes to two lines worth, the CSS then no longer works correctly.

<div class="col-xs-offset-1 col-xs-10 col-sm-offset-0 col-sm-4">
    <div class="navigation-links">
      <h2><a href="#" id="text-display" class="network"
        onmouseover="changeText('More network information here')"
        onmouseout="defaultText()">Network</a></h2>
    </div>
  </div>

PHP variable ['url'] pushing wrong variable

I am not understanding why my variable $linkedin is not working properly. When I click the text, "linkedin" it will not redirect me to www.yahoo.com but instead add to the site.url + "/$linkedin". After I added the variable $linkedin into the if statements it will no longer appear and I believe it is because the variable is not identifying itself as a url. Causing it to fail if statements. Lastly, this is on WordPress + Advanced Custom Fields Plugin.

Added into the code a var_dump to hopefully show what my issue is.

Code:

function member_contact() {

    $vcard = get_field('vcard');
    $bio   = get_field('bio_pdf');
    $linkedin = get_field('linkedin');
    $phone = get_field('phone');
    $fax   = get_field('fax');
    $email = get_field('email');

    $post_info = '';

    if (isset($vcard['url'])) {
        $img = get_stylesheet_directory_uri() . "/images/mail-icon.png";
        $post_info .= '<a class="vcard" href="'.$vcard['url'].'"><img src="'.$img.'" /> Download Contact</a>';
    }

    if (isset($bio['url']) && isset($vcard['url'])) {
        $post_info .= ' | ';
    }

    if (isset($bio['url'])) {
        $post_info .= '<a class="bio-pdf" href="'.$bio['url'].'">Download Bio</a>';
    }

    if (isset($linkedin['url']) && isset($vcard['url']) || isset($bio['url'])) {
        $post_info .= ' | ';
    }

    if (isset($linkedin['url'])) {
        $post_info .= '<a href="'.$linkedin['url'].'"><i class="fa fa-linkedin" style="color:blue"></i> Linkedin</a>';
    }


    $post_info .= '<ul class="member-contact">';
    $post_info .= "<li>$email</li>";
    $post_info .= "<li>p: $phone</li>";
    $post_info .= "<li>f: $fax</li>";
    $post_info .= "</ul>";
    var_dump($linkedin);

Images:

HTML Front-End

enter image description here

HTML Back-End

enter image description here

Custom Field Plugin enter image description here

How to Add html reader inside json reader? [on hold]

I have problem ...about how to read the html syantax that as the value of json object ..below is the snipet.

The problem is that I am not able to parse because the jsonString contains characters such as "\" and "'".and html syantax

//Sample string { "title" : "

Sample Text

" }

Please see at the "title" json object ..that has value of html syantax . When i launch the app ..it shown syantax html :'(

Navbar color change after defined y position

I have a nice navbar that is fixed to the top of the window. When a user scrolls past a certain div, it will change the background color of the navbar. Up to this point, it has been working great for me.

I recently added a few anchor links to my website. Now when a user clicks on an anchor link and is brought to the page with the navbar on it, the navbar is not the correct color. It is only when the user scrolls a little, that the navbar changes color. But I would like the navbar to have the correct background color as soon as the user lands on the page.

$( document ).ready(function() {
var mainbottom = $('.changenavcolor').offset().top +        $('.changenavcolor').height();

// on scroll, 
$(window).on('scroll',function(){

// we round here to reduce a little workload
stop = Math.round($(window).scrollTop());
if (stop > mainbottom) {
    $('.os .navbar').addClass('navbarblue');
} else {
    $('.os .navbar').removeClass('navbarblue');
}

});
});

Bootstrap carousel moves down when in mobile mode when i press the toggle navbar

In mobile view, when the navbar collapses and i press on the toggle, the navbar behaves as it should but the carousel also moves down along with it. Also there is a 70px gap between the navbar and the carousel, which i used to fix by adding a negative margin-top on the carousel so it goes up by force, but how do i do this naturally?

Thank you!

Center images in a div with equal horizontal and vertical spacing

I have a div containing 10 images, each with its own div:

<div id="TankDialog" title="Choose Tank" style="display:none">
      <div class="ImageBox"><img src="images/tanks/tank1.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank2.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank3.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank4.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank5.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank6.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank7.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank8.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank9.png" style="width:150px" /></div>
      <div class="ImageBox"><img src="images/tanks/tank10.png" style="width:150px" /></div>
</div>

These images are not uniform in size but I am forcing them all to 150px. But I want to lay out the images in a grid-like fashion so that they're each inside an invisible box that takes the same amount of horizontal and vertical space. And I want each image centered inside its invisible box. The divs around the images are just to aid with positioning/placement--if they're not necessary to achieve this layout, that's fine. The problem is that each image gets positioned at the top left of its div, rather than in the center. Here is the ImageBox class:

.ImageBox{
    float:left;
    width:177px;
    height:177px;
    display:block;
    margin: 0 auto;
}

Notice in the screenshot below how the image aligns in the top-left rather than the center. How can I fix this?

enter image description here