You didn't say what is the problem or what you don't know how to do it.
So, let me suggest you something, test your getdat.php in the browser and see what is the result.
You didn't say what is the problem or what you don't know how to do it.
So, let me suggest you something, test your getdat.php in the browser and see what is the result.
You need to show the div when msg === true
:
$('#result').html(quantity+' items');
$('#result').show();
// OR, using chaning
$('#result')
.html(quantity+' items')
.show();
Also, this is very ugly and with poor performance: $('input:text#quantity').val();
Use just #quantity
or as you are already inside the event scope, you could use just $(this)
.
So, I think this code would be better wrote as:
$('#quantity').keyup(function(){
var
quantity = $(this).val()
, $result = $('#result');
if(isInteger(quantity))
{
var msg = false;
if(quantity > 1)
{
msg = true;
}
// more code . . .
if(msg === true)
{
$result
.html(quantity+' items')
.show();
}
else
{
$result.hide();
}
}
});
I think it's ok, but I'd use more like this:
function isDuplicate(names,phone,email,adresa){
var isduplicate=false;
for(var i=0,il=addresslist.length, addr; i<il, addr=addresslist[i]; i=i+1){
if( addr.names.toLowerCase()==names.toLowerCase()
&& addr.phone.toLowerCase()==phone.toLowerCase()
&& addr.email.toLowerCase()==email.toLowerCase()
&& addr.adresa.toLowerCase()==adresa.toLowerCase()
)
{
isduplicate=true;
break; // Stop loop if it's duplicated
}
}
return isduplicate;
}
// Verify if value is only number
function isNumber(val) {
return !isNaN(parseInt(val));
}
Like this:
///For 2nd Schedule Interview
$('#cbmSSId').bind('change', function(e) {
e.preventDefault();
var value = $(this).val();
if ( value == 'Interviews' ) {
$('#Interviews').bPopup();
}
else if ( value == 'Something Else') {
}
else {
}
});
What didn't you understand?
I'd use something like this:
var lis = [];
for(var i=0, il=items.length,item; i<il, item=items[i]; i=i+1){
lis.push(String.format(
'<li> ' +
'{0} [ {1} ] [ {2} ] [ {3} ] ' +
'<a href="void(0);" class="deletebtn" contactid="{4}"> delete contact </a>' +
'</li>'
, item.names, item.phone, item.email, item.adresa, item.id
));
}
list.html(lis.join(""));
The String.format method is this one:
// --------------------------------------
// String.format
// --------------------------------------
String.prototype.format = function () {
return String.format(this, arguments.length == 1 ? arguments[0] : arguments);
};
String.format = function (source, params) {
var _toString = function (obj, format) {
var ctor = function (o) {
if (typeof o == 'number')
return Number;
else if (typeof o == 'boolean')
return Boolean;
else if (typeof o == 'string')
return String;
else
return o.constructor;
} (obj);
var proto = ctor.prototype;
var formatter = typeof obj != 'string' ? proto ? proto.format || proto.toString : obj.format || obj.toString : obj.toString;
if (formatter)
if (typeof format == 'undefined' || format == "")
return formatter.call(obj);
else
return formatter.call(obj, format);
else
return "";
};
if (arguments.length == 1)
return function () {
return String.format.apply(null, [source].concat(Array.prototype.slice.call(arguments, 0)));
};
if (arguments.length == 2 && typeof params != 'object' && typeof params != 'array')
params = [params];
if (arguments.length > 2)
params = Array.prototype.slice.call(arguments, 1);
source = source.replace(/\{\{|\}\}|\{([^}: ]+?)(?::([^}]*?))?\}/g, function (match, num, format) {
if (match == "{{") return "{";
if (match == "}}") return "}";
if (typeof params[num] != 'undefined' && params[num] !== null) {
return _toString(params[num], format);
} else {
return "";
}
});
return …
See if this works:
$(function(){
$('ul#groupCat li').click(function(){
var
catChoice= $(this).attr('cat'),
$subMain = $("#subMain");
if(catChoice == "00"){
$subMain.find("div.box").slideDown();
$subMain.find("div.categorie").slideDown().removeAttr('catsort');
return;
}
$subMain
.find('div.categorie[cat!="' + catChoice + '"]') // div categorie who is not the catChoice
.slideUp();
$subMain
.find("div.categorie[cat=" + catChoice + "]") // div categorie who is the catChoice
.attr('catsort', 'Yes')
.slideDown()
.parent() // box who has the catChoice categorie
.slideDown();
$subMain
.find('div.box:not(:has(div.categorie[cat="' + catChoice + '"]))') // Only boxes that does not have the categorie
.slideUp();
});
});
Try like this:
$.ajax({
url: 'addressbook.php',
data: {
action: 'add',
name: name,
phone: phone,
email: email,
adresa: adresa
},
dataType: 'json',
type: 'post'
});
Try something like this(not tested):
$(function(){
$('ul#groupCat li').click(function(){
var
catChoice= $(this).attr('cat'),
$subMain = $("#subMain");
if(catChoice == "00"){
$subMain.find("div.box").slideDown();
$subMain.find("div.categorie").slideDown().removeAttr('catsort');
return;
}
$subMain
.find('div.categorie[cat!="' + catChoice + '"]') // div categorie who is not the catChoice
.slideUp();
$subMain
.find("div.categorie[cat=" + catChoice + "]") // div categorie who is the catChoice
.attr('catsort', 'Yes')
.slideDown()
.parent() // box who has the catChoice categorie
.slideDown()
.siblings("div.box") // other boxes
.slideUp();
});
});
You didn't correct the issues that I told you.
Check the response using the success event. Like this:
sucess: function(data, textStatus) {
}
You should use your browser JS debugger and Networking monitoring to identify the errors.
You should also certify that your PHP configuration is set to show all the errors.
I don't think so. It should be like this:
$.ajax({
url: 'addressbook.php?action=saveContact',
data: {
name: name,
phone: phone,
email: email,
adresa: adresa
},
dataType: 'json',
type: 'post'
});
First of all, you shoudln't have multiple elements with the same ID. ID selectors only return the first element. So, use class instead of id in this case: <div class="categorie">
Then you should use the attribute selector of jQuery for selectiong an element with an specific cat
attribute. Like this: $("#subMain).find("div.categorie[cat=2]")
I think there's no problem, it's good. If they already have the data in excel it's the easiest way to update the DB.
Couple months ago I did an web app so the user could upload the excel and import to the SQL DB.
If you are thinking of doing such thing, I recommend using C# and EPPLus lib, it was really peaceful to work with ^^
I think it could be something like this:
if(!empty($secondMenus)) {
$backgroundColor = $idMenuParent == 2 ? 'blue' : 'gray';
?>
<div id="secondary-menu-main">
<div id="secondary-menu-items" style="background-color: <?php echo $backgroundColor; ?> ">
<?php
foreach($secondMenus as $secondMenu) {
Good to know. You're welcome.
Just mark the post as solved please.
Ok, this will be easy and painless ^^
There's a lot of nice jQuery ToolTip plugins. Take a look at those sites:
http://calebjacob.com/tooltipster/
http://www.1stwebdesigner.com/css/stylish-jquery-tooltip-plugins-webdesign/
http://jqueryui.com/tooltip/
Most of them will use the attributes Title
for the text, so you can make like this before using the plugins:
$("#addtocart")
.attr("Title", "My tooltip text")
.tooltipster();
Check this demo, I coded like an jQuery plugin:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(function(){
$("#main").children().eq(0).fadeToNext(1000, 1000, 1000);
});
(function($){
$.fn.extend({
/*
@fadeInTime Time of the FadeIn effect in milliseconds
@shownTime Time between the finish of the FadeIn and the start of the FadeOut effect in milliseconds
@fadeOutTime Time of the FadeOut effect in milliseconds
*/
fadeToNext: function(fadeInTime, shownTime, fadeOutTime) {
var
$this = $(this), // Current element
$siblingsAndSelf = $this.parent().children(); // All children of it's parent
$this
.fadeIn(fadeInTime) // Show Item
.delay(shownTime) // Stay shown
.fadeOut(fadeOutTime, function() { // Hide Item
// When finish hiding gets the next item to be shown
var
$next = ($this.index() == $siblingsAndSelf.length-1) ? // If last children of parent
$siblingsAndSelf.eq(0) : // First children of parent
$this.next(); // Next sibling
// Show the next item
$next.fadeToNext(fadeInTime, shownTime, fadeOutTime);
});
}
});
}(jQuery));
</script>
</head>
<style type="text/css">
#main{
width: 100%;
height: 100%;
border:1px solid #FF0000;
position:absolute;
}
#main > div {
width: 200px;
height: 200px;
border: 2px solid black;
position: absolute;
border: 3px solid #FF0000;
display: none;
background: #00F;
top: 50px;
left: 50px;
font-size: 70px;
line-height: 200px;
text-align: center;
color: #fff;
}
</style>
<body>
<div id="main">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>
</body>
</html>
Ps.:All itens to be faded needs to have the same parent, and all children of this parent will be faded
But can you add javascript code to your site? Does the site uses jQuery?
Oh I see... well, only with CSS it's impossible. With JS is possible, and if it can use jQuery it'll be a lot easier.
Position
is a reserved word, you should put it in braces: [Position]
.
I think this should solve your problem.
It's always good to put names inside []
, it can save a lot of time trying to find an error.
Look at this link for more information: http://msdn.microsoft.com/en-us/library/aa238507(v=sql.80).aspx
Hi, I'd try something like this:
function fadeElements() {
var yourFade = 1, // the amount of time in seconds that the elements will fade in AND fade out
yourDelay = 2, // the amount of time in seconds that there will be a delay between the fade ins and fade outs
fadeTime = yourFade * 1000, //convert fade seconds to milliseconds (1000)
delayTime = yourDelay * 1000, // convert delay seconds to milliseconds (2000)
totalTime = fadeTime + delayTime, //3000 milliseconds...needed for all those delays we talked about
i=0,
$elements = $('.FadingBanner'),
elementsLength = $elements.length;
$('.FadingBanner').each(function(){
$(this) // Current element
.delay( totalTime * i )
.fadeIn(fadeTime)
.delay(delayTime)
.fadeOut(fadeTime);
i = i + 1;
});
// Set to call the same function again after (totalTime * elementsLength) milliseconds
setTimeout(fadeElements, totalTime * elementsLength);
}
$(function(){
fadeElements();
});
Ps.: I didn't test any of this, but it should work (I Hope! ^^)
To show the default tooltip just add the attributes title="Buy"
and alt="Buy"
.
If you want a more sofisticated tooltip you'll need javascript to create it.
What do you mean by "same level"? Can you post a print of what you are trying to accomplish?
You are not setting the string to the return of the method. It should be:
textContent = getLimitedWords(textContent, NumberOfWords);
Or you could use a reference parameter, like this:
getLimitedWords(ref textContent, 20);
public string getLimitedWords(ref string textContent, int NumberOfWords){}
dancks, great idea for learning!
About floating divs... I hate it! I just think it's too much pain to use it, if you forget to use clean
after the headache will be huge.
Because of that I ended up using a custom css class to make elements inline:
.inline
{
position: relative;
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
vertical-align: top;
*display: inline;
}
And the use is like this:
<div class="inline">
<img src="..."/>
</div>
<div class="inline">
bla bla bla bla bla bla bla
</div>
Hope it helps
I think it's just a syntax problem... It's been a while since I coded in PHP, but this should work:
echo '<a href="'.$info['link'].'">.'$info['description'].'</a>';
Hello,
I'd made it something like this:
function initializeSelect(selectId, divQuantityId){
var
select = document.getElementById(selectId), // gets the select element
divQuantity = document.getElementById(divQuantityId); // gets the div element
for(var i = 0; i <=20; i++) {
// create the option
var option = document.createElement('option');
option.innerHTML = i;
option.value = i;
// append the option
select.appendChild(addOption);
}
// sets the onChange event to the select
select.onchange = function() {
divQuantity.innerHTML = select.value; // display the selected value on the div
};
}
And then use the function like this:
initializeSelect('product1', 'quantity1');
initializeSelect('product2', 'quantity2');
You can't remove only the X button you have to remove the control box, like this:
this.ControlBox = false
Boolean is true of false, right? So normally it's used exactly to get/set if a "thing" Can or Can't be done, if it Is or if it isn't and if it Has or Hasn't something.
Examples:
this.HasChildren
this.IsVisible
this.CanUpdate or this.IsUpdatable
I don't know the fields and tables of your DB, but the point is that you can make an insert from a select. Did you get that?
Check those lins:
http://dev.mysql.com/doc/refman/5.1/en/insert-select.html
http://stackoverflow.com/questions/5391344/mysql-insert-with-select
This select return 0 rows?
SELECT
NULL, id_product, 0, id_supplier, supplier_reference, wholesale_price , 3
FROM
ps_product
If so, it means that there's no rows in your table.
Nathaniel10,
even thru innerHTML is not an W3C standad, almost every modern browser implement it.
Take a look at this http://www.quirksmode.org/dom/w3c_html.html
And if you really doesn't want to use it, use Object.style.textAlign
to set the alignment.
You are getting the X and Y values as strings, so insted of adding it's concatenating.
Ie.: '7' + 10 = 710
Update those two lines:
var rx= parseInt( document.getElementById('rx').value );
var ry= parseInt( document.getElementById('ry').value );
Something like this:
DELETE FROM my_table WHERE col1 IS NULL AND col2 IS NULL AND col3 IS NULL AND col4 IS NULL
Does it throw any errors?
First test only the select part and see if it returns any rows.
Yes, you could do it with PHP. You'd have to make a select on the rows you want to insert, then loop thru them and insert each record.
So you'll need a simple query just ordering the results by the stock number. Then when displaying the results you'll have to check if the previous record has the same stock number, if it has don't display it, if it's different, then display it.
I think that the only thing you need is to order the select by stockNumber. Group is used when you want to make an calculation on the values, like SUM or AVG, but it doensn't seem that is what you want.
Do you want to tranform the query result in an object oriented array? Something like the Stock object has an array of Storages? Is that it?
What this script does is:
Select the specified columns from ps_products, and insert each returned row into ps_product_suplier.
The table ps_product will not be changed.
Use a select from the ps_product table to insert into ps_product_supplier. Something like this:
INSERT INTO ps_product_supplier
(id_product_supplier, id_product, id_product_attribute, id_supplier, product_supplier_reference, product_supplier_price_te, id_currency)
SELECT
NULL, id_product, 0, id_supplier, supplier_reference, wholesale_price , 3
FROM
ps_product
But you don't want it to exceed or you want the footer to go down with it?
Good to hear it.
So mark as solved please =)
But how do you want the result to be?
Try this and see if works:
<?php
function user_exists($username)
{
return true;
}
if(empty($_POST) === false)
{
$username = $_POST['userName'];
$password = $_POST['password'];
if(empty($username) === true || empty($password) === true)
{
$errors[] = 'please enter a username and password';
}else if(user_exists($username) === false)
{
$errors[] = 'we can\'t find that user, please contact AZ Media Production';
}else
{
$login = login($username, $password);
if($login == false)
{
$errors[] = 'That username/password combination is incorrect';
}else
{
$_SESSION[`user_id`] = $login;
header('Location: anounceEdit.php');
exit();
}
}
print_r($errors);
}
?>
Even with the function in the same file and only returning true? Well, that's really strange.
Just to make sure, remove the import of init.php
Ok, it's been a while since I coded PHP, but I'd do the following tests:
If the first test is successful it means that is something wrong with the path of the file your are importing or another error is causing this one.
If only the second test is successful it means that the code inside the function is wrong.
If none of them work, let me know and I'll try to think of something else =)
Your function is named wrong.
Named function: user_exsists
Used function: user_exists
Just a typo.
There's no magic way to do it, but there's others ways like storing the values A,B,C in an array and loop for a match or using RegEx.
I'd use RegEx for a short code, something like this:
IF ( RegEx.Match(TextBox1.Text, "^[ABC]$").Success ) Then
End If
To use RegEx you need to import System.Text.RegularExpressions
.
I didn't understand much of what your problem is. But is something like this that you want?
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css">
<style>
div
{
text-align: right;
padding: 1px;
margin: 1px;
color: #006666;
font-family: arial;
font-size:28pt;
font-weight:700;
background-color:
}
</style>
<script type="text/javascript">
function calculate(inputId, outputId)
{
A = document.getElementById(inputId).value;
outDiv = document.getElementById(outputId);
B =(parseInt(A) * 1.0);
//alert(A);
D = (parseInt(B) * 1.0 );
if ( B <= 19)
{
tax = 0.00;
}
else if (B <= 30)
{
tax = (B * 3.95) * 1;
}
else if (B <= 40)
{
tax = (B * 3.75) * 1;
}
else if (B <= 50)
{
tax = (B * 3.70) * 1;
}
else if (B <= 60)
{
tax = (B * 3.55) * 1;
}
else if (B <= 70)
{
tax = (B * 3.40) * 1;
}
else if (B <= 80)
{
tax = (B * 3.25) * 1;
}
else if (B <= 90)
{
tax = (B * 3.10) * 1;
}
else if (B <= 100)
{
tax = (B * 2.95) * 1;
}
else if (B <= 150)
{
tax = (B * 2.80) * 1;
}
else if (B <= 200)
{
tax = (B * 2.65) * 1;
}
else
{
tax = (B * 2.60) * 1;
}
outDiv.innerHTML = '£'+tax;
}
</script>
</head>
<BODY>
<p style="margin-left: 3">
<i><font face="Arial" color="#006666" style="font-size: 9pt">Enter Quantity (sq m)</font></i>
<INPUT id='inputA' NAME="text2" size="1" value="20"maxlength="3" /> …
I don't know if it was a typo on the post, but it's $_POST and not $POST.
Another thing, I'm guessing, but I don't hink <input type="(float)number" name="price" />
is a valid markup.