mercredi 5 août 2015

Will page automation with PhantomJS be lost after a page redesign?


I'm quite new to PhantomJS. I want to do page automation with PhantomJS to a web site by manipulating the HTML elements (for example: taking buttons/links by their IDs and triggering clicks) and going from one page to another and doing the same things.

What I was wondering is: This is actually a web system that is created and belongs to some company, so in the future if they decided to make a complete redesign to their system my whole work will be lost, since they will have completely new design with new HTML structure and new IDs of elements. Is that correct? Is there a way to handle this problem?



via Chebli Mohamed

Active menu Changer on Sticky Bar


I have designed a Parallax Page with Sticky Menu bar. I need to change the active menu on scrolling. I have made it to change the active class on Click event. But I need it to do for the scroll event.

Here is my HTML Code

<div class="main-menu">

    <ul>             
        <li><a class="active" href="#" data-delay="2000" data-appear="false" data-scrollto="#intro-slideshow">Home</a></li>
        <li><a href="#" data-delay="2000" data-appear="false" data-scrollto="#overview">Features</a></li>
        <li><a href="#" data-delay="2000" data-appear="false" data-scrollto="#categories">Categories</a></li>
        <li><a href="#" data-delay="2000" data-appear="false" data-scrollto="#contact">Contact Us</a></li>
    </ul>

</div>

Here is my JQuery Code for Onclick Active Menu Changer

$('*[data-scrollto]').click(function(){

        $( "a" ).removeClass( "active" );
        $(this).addClass("active");

        var dest = $(this).data('scrollto');                
        var pixels = $(dest).offset().top - 70;         
        var ms = Math.round(1000 + pixels/5);

        $('html, body').animate({               
            scrollTop: pixels
        }, ms, 'easeOutQuint');

    }); 

How do I change the active class on Scroll Event with the Data-Scrollto attribute ?



via Chebli Mohamed

Edit and Save Pivot Table in Database in ASP.NET


I want to create an ASP.Net web page which will have one DropDownList control and upon changing the selection of it. Pivot table should be created. The Column Headers and Row Headers of this table should come from Database. The values shown in this table will also be retrieved from Database with respect to the corresponding Column Header and Row Header. This table values should be editable and upon "SAVE" button click the Data in values should be saved in database for corresponding Column Header and Row Header. example:

           |   Lot1   |   Lot2  |   Lot3 |  ...
---------------------------------------------
Product1   |    100   |  2000   |   3000 |  ...
---------------------------------------------
Product2   |    1000  |  3000   |   4000 |  ...
---------------------------------------------
Product3   |    3500  |  6000   |   4500 |  ...
---------------------------------------------

. . These values should be editable and upon save button click these should save in database with respect to Lot number and Product.



via Chebli Mohamed

Change style of element which appears directly before another element on the same level


My issue is as follows: I've got a navigation bar with main navigation and some of these links have additional drop down menus. I'm trying to change the styling of the main link, whenever I hover over the drop down menu. I can't use classes as it will change the style of all the main nav links. Which means I can't use the following method

.dropdown:hover ~ .main{
    change css here
}

I also can't use individual IDs for the linked drop down and main nav as it appears on too many pages already.

The format of the HTML is as follows

<a class="main-link">Main Link</a>
<div class="drop-down"></div>

My question is; is there a way to change the style of an element which appears directly before an element within a HTML document?



via Chebli Mohamed

How to remove � sign from whole site in wordpress


I have uploaded wordpress site on live , then the one "�" sign is being appearing in between content , but it is fine in local. How to remove please suggest me ? I am not able fix the problem.

Example - Frédèric becomes Fr�d�ric.



via Chebli Mohamed

How to automatically sum input value boxes on each row in a HTML table


I have an HTML table with columns of input boxes(Quantity, Price, Discount and Total). I made a JS function for adding as many rows as I need. I would like to make the Total column, for each row, to display automatically the value of this formula:

(Quantity * Price) - ( Quantity * Price * (Discount/100)) .

I tried numerous JavaScript code, but I have been unable to get anything to correctly work.

HTML:

<table id="myTable">
<tr>
<th width="65%"></th>
<th align="center" width="5%">Q<br>-ty</th>
<th align="center" width="10%">Price,</br>$</th>
<th align="center" width="5%">Discount,<br>%</th>
<th align="center" width="15%">Total, $<br>(Without tax)</th>
</tr>
<tr>
<td width="65%"><input class="Left" size="100" type="text" name="Description"></td>
<td align="center" width="5%"><input type="number" name="quantity" min="1" max="99"></td>
<td align="center" width="10%"><input type="number" name="summ" min="0" max="999999"></td>
<td align="center" width="5%"><input type="number" name="rate" min="0" max="100"></td>
<td align="center" width="15%"><input align="center" type="number" name="total" min="0" max="99999999"></td>
</tr>
</table>
<button onclick="addRow()">Add Row</button>

Javascript:

function addRow() {
    var table = document.getElementById("myTable");
    var row = table.insertRow();
    var cell1 = row.insertCell(0);
    var cell2 = row.insertCell(1);
    var cell3 = row.insertCell(2);
    var cell4 = row.insertCell(3);
    var cell5 = row.insertCell(4);
    cell1.innerHTML = "<input class=\"Left\" size=\"100\" type=\"text\" name=\"Description\">";
    cell2.innerHTML = "<div align=\"center\"><input type=\"number\" name=\"quantity\" min=\"1\" max=\"99\"></div>";
    cell3.innerHTML = "<div align=\"center\"><input type=\"number\" name=\"summ\"  min=\"0\" max=\"999999\"></div>";
    cell4.innerHTML = "<div align=\"center\"><input type=\"number\" name=\"rate\"  min=\"0\" max=\"100\"></div>";
    cell5.innerHTML = "<div align=\"center\"><input type=\"number\" name=\"total\" min=\"0\" max=\"99999999\"></div>";
}

My code on FIDDLE.



via Chebli Mohamed

How to prevent an iframe to display external websites?


Let's say I display an iFrame on iframe.domain.com. I want this iframe to be able to display content from iframe.domain.com or sub.domain.com. But those websites contain link to external websites, for example google.com. If the users clicks on a link redirecting him to google.com, I want the iFrame to be redirected to sub.domain.com

How can I do that?



via Chebli Mohamed