I am opening a popup window from javascript using window.open. I want to open this popup window at right corner of the page (height="700px" width="400px"). How can i achieve this
You can call the following method as:
popUpAtMyWish("yourpage","windownamehere",500,600);
function popUpAtMyWish( pageToLoad, winName, width, height)
{
xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 )){
xposition = (screen.width - width);
yposition = (screen.height - height);
}
var args = "";
args += "width=" + width + "," + "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=0,"
+ "statusbar=false,dependent,alwaysraised,"
+ "status=false,"
+ "titlebar=no,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //NN Only
+ "screeny=" + yposition + "," //NN Only
+ "left=" + xposition + "," //IE Only
+ "top=" + yposition; //IE Only
var dmcaWin = window.open(pageToLoad,winName,args );
dmcaWin.focus();
}
Related
TrainAttempt$PriceGuess <- with(TrainAttempt,
0+(LotFrontage*1)+(LotArea*1)+
(MasVnrArea*1)+(BsmtFinSF1*1)+
(BsmtFinSF2*1)+
(BsmtUnfSF*1)+
(TotalBsmtSF*1)+
(GrLivArea*1) +
(BsmtFullBath*1) +
(BsmtHalfBath*1) +
(FullBath*1) +
(HalfBath+0) +
(BedroomAbvGr*1) +
(KitchenAbvGr*1) +
(TotRmsAbvGrd*1) +
(Fireplaces*1) +
(OpenPorchSF*1) +
(GarageArea*1) +
(WoodDeckSF*1) +
(OpenPorchSF+0) +
(EnclosedPorch*1) +
(ScreenPorch*1) +
(PoolArea*1) +
(MiscVal*1))
I am using FullCalendar 3.5.1
My events are rendered through eventRender by injecting some links on the event data. These links works on Month view. But when I switch to Week or Day view, those links are un-clickable.
I have put a jsfiddle here https://jsfiddle.net/y8d0v6o3/1/
On the fiddle in month view throw console error but that is because not all functions are there on the fiddle but it also implies that links are getting clicked. On the Day/Week view there is not even an error.
eventRender: function(event, element, view) {
element.find(".fc-title").remove();
//element.find(".fc-time").remove();
$(element).css("margin-top", "3px");
$(element).addClass('event-on-' + event.start.format('YYYY-MM-DD'));
var wsTitleStyle = 'class="titlelinkConfirm"';
if(event.autoscheduled){
wsTitleStyle = 'class="titlelinkAutoSchd"';
}
if(event.missed){
//if missed change title color
wsTitleStyle = 'class="titlelinkMissed"';
}
var pbSurveyFlag = event.isSurvey ? 2 : 1;
if(event.title == 'ZZZZXXXYYY'){
event.eventBorderColor = '#FFF';
var wsMomentDate = event.start.format('YYYY-MM-DD');
var new_description ='<br/><a class="alink" href="javascript:calDetails('+ '''+'audits-appt-day.cfm' + '''+',500,400,' + '''+event.encryptedStart +''' +',' + '''+ 'dayView' + ''' + ','+'0' +')">'
+ 'Details' + '</a>' + ' '
+ '<a class="alink" href="javascript:calDetails('+ '''+'audits-mapDay.cfm' + '''+',800,600,' + '''+event.encryptedStart +''' +',' + '''+ 'dayView' + ''' +',' + ''' + wsMomentDate +''' +')">'
+ '<strong>Map Day</strong>' + '</a>'
;
element.append(new_description);
//do not allow this to be dragged
event.editable = false;
}else{
if (event.autoscheduled && !event.missed){
slink = '<a class="alink" href="javascript:doConfirmCal(' + '''+ event.auditID+'''+','+event.eventID+')">Confirm</a>';
} else if(!event.missed){
slink = '<a class="alink" href="javascript:popupReDirectEncryptedURL('+ '''+ 'auditID=' + event.auditID +'&missed='+ event.eventID +'&type=' + pbSurveyFlag+ '''+',' + '''+ 'ticket-progress.cfm' +''' + ',' + '800,500,'+ '''+'apptLetter' + '''+')">Missed</a>';
}
var new_description = '<a ' +wsTitleStyle+ ' href="javascript:LoadApptPage(' + event.eventID +',' + pbSurveyFlag +')">'
+ event.title + '</a><br/><br/>'
+ '<a class="alink" href="javascript:LoadFlexPage(' + ''' + event.auditID + ''' +',' + '''+pbSurveyFlag +''' +')">'
+ 'View' + '</a>' + ' '
+ slink
+ '<br/>' + ' ' + '<a class="alink" href="admin-timeTracking.cfm?isSurvey=' +pbSurveyFlag+'&auditID=' + event.auditID +'&date='+event.encryptedStart +'">'
+ 'Submit Time' + '</a>'
;
element.append(new_description);
}
}
I found that it was issue of z-index. Fullcalendar.css add z-index to it's css elements. So I added
postion:relative;
and a z-index high enough on my anchor tag css and that solved the issue.
I cannot display labels of nodes using a force-layout in d3.js.
I'm trying with this example http://d3js.org/d3.v3.min.js
I updated that code only adding zoom, like this:
var svg = d3.select("body").append("svg").attr("width", width).attr("height", height).append('svg:g').call(d3.behavior.zoom().on("zoom", redraw));
function redraw() {
console.log("here", d3.event.translate, d3.event.scale);
svg.attr("transform", "translate(" + d3.event.translate + ")" + " scale(" + d3.event.scale + ")");
node.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
}
Why are labels not displayed?
You need to separately add the text:
node.append("text")
.attr("dx", ".10em")
.attr("dy", ".10em")
.text(function(d) { return d.name; });
see these examples:
http://bl.ocks.org/mbostock/2706022
http://bl.ocks.org/mbostock/1153292
Following is my code.I have used class in my website.But i am getting error as "Incorrect syntax near ',' ".....can anyone tell me what is wrong in the code..
protected void btnadd_Click(object sender, EventArgs e)
{
s1 = "Update tckt_tbl Set class='" + ddlclass.Text + "',dist=" + lbldist.Text + ",no_of_adults=" + ddladults.Text + ",no_of_senior=" + ddlsenior.Text + ",n1='" + txtn1.Text + "',";
s1 += "n2='" + txtn2.Text + "',n3='" + txtn3.Text + "',n4='" + txtn4.Text + "',n5='" + txtn5.Text + "',n6='" + txtn6.Text + "',";
s1 += "ag1=" + txtag1.Text + ",ag2=" + txtag2.Text + ",ag3=" + txtag3.Text + ",ag4=" + txtag4.Text + ",ag5=" + txtag5.Text + ",ag6=" + txtag6.Text + ",";
s1 += "gen1='" + txtgen1.Text + "',gen2='" + txtgen2.Text + "',gen3='" + txtgen3.Text + "',gen4='" + txtgen4.Text + "',gen5='" + txtgen5.Text + "',gen6='" + txtgen6.Text + "',";
s1 += "cn1='" + txtchn1.Text + "',cn2='" + txtchn2.Text + "',cag1=" + txtcag1.Text + ",cag2=" + txtcag2.Text + ",cgen1='" + txtcgen1.Text + "',cgen2='" + txtcgen2.Text + "' Where userid=" + Session["suser"].ToString() + "";
con.ExecQuery(s1);
Response.Redirect("tcktbook_itckt.aspx");
}
First off, it is a really bad idea to build a query from user input. I suggest you use a parameterized query instead.
Try outputting s1 to see what the query looks like.
Chances are good that you have an unbalanced quote.
On third line there is problem.
s1 += "ag1=" + txtag1.Text + ",ag2=" + txtag2.Text + ",ag3=" + txtag3.Text + ",ag4=" + txtag4.Text + ",ag5=" + txtag5.Text + ",ag6=" + txtag6.Text + ",";
I think here commas and semicoluns are not given properly.
I suggest you use Parameter Query, rather than concatenate everything. But before that, are you sure that you already give all value? Because if you didn't give any value for numeric field, it should show an error, since the query become:
..cag1=,cag2..
I have to insert values into database table wp_ratings table using ajax in wordpress but it is not working. Below is the code i am using:
Ajax call:
$(function(){
$('#submit').click(function(){
var rating_allowed=document.getElementById("rating_allowed").value;
var product_id=document.getElementById("product_id").value;
var user_id=document.getElementById("user_id").value;
var pc_ip=document.getElementById("pc_ip").value;
var performance_input=document.getElementById("performance_input").value;
var features_input=document.getElementById("features_input").value;
var battery_input=document.getElementById("battery_input").value;
var overall_input=document.getElementById("overall_input").value;
var rating_cat_count=document.getElementById("rating_cat_count").value;
var rate_1_name_find=document.getElementById("rate_1_name_find").value;
var rate_2_name_find=document.getElementById("rate_2_name_find").value;
var rate_3_name_find=document.getElementById("rate_3_name_find").value;
var rate_4_name_find=document.getElementById("rate_4_name_find").value;
var pros=document.getElementById("pros").value;
var cons=document.getElementById("cons").value;
alert("g");
alert("action=updateRating&product_id=" + product_id + "&user_id=" + user_id + "&pc_ip=" + pc_ip + "&performance_input=" + performance_input + "&features_input=" + features_input + "&battery_input=" + battery_input + "&overall_input=" + overall_input + "&rating_cat_count=" + rating_cat_count +"&rate_1_name_find=" + rate_1_name_find + "&rate_2_name_find=" + rate_2_name_find + "&rate_3_name_find=" + rate_3_name_find + "&rate_4_name_find=" + rate_4_name_find + "&pros=" + pros + "&cons=" + cons);
$.ajax({
url:"/wp-admin/admin-ajax.php",
type:'POST',
data:"action=updateRating&product_id=" + product_id + "&user_id=" + user_id + "&pc_ip=" + pc_ip + "&performance_input=" + performance_input + "&features_input=" + features_input + "&battery_input=" + battery_input + "&overall_input=" + overall_input + "&rating_cat_count=" + rating_cat_count +"&rate_1_name_find=" + rate_1_name_find + "&rate_2_name_find=" + rate_2_name_find + "&rate_3_name_find=" + rate_3_name_find + "&rate_4_name_find=" + rate_4_name_find + "&pros=" + pros + "&cons=" + cons,
success:function(results)
{
alert(results);
}
});
}
);
});
in functions.php file:
function implement_ajax_updateRating()
{
$p_id = mysql_real_escape_string(htmlentities(trim($_POST['product_id'])));
$user_id = mysql_real_escape_string(htmlentities(trim($_POST['user_id'])));
$pc_ip = mysql_real_escape_string(htmlentities(trim($_POST['pc_ip'])));
$rate_1 = mysql_real_escape_string(htmlentities(trim($_POST['performance_input'])));
$rate_2 = mysql_real_escape_string(htmlentities(trim($_POST['features_input'])));
$rate_3 = mysql_real_escape_string(htmlentities(trim($_POST['battery_input'])));
$rate_4 = mysql_real_escape_string(htmlentities(trim($_POST['overall_input'])));
$rating_cat_numbers = mysql_real_escape_string(htmlentities(trim($_POST['rating_cat_count'])));
$rate_1_find = mysql_real_escape_string(htmlentities(trim($_POST['rate_1_name_find'])));
$rate_2_find = mysql_real_escape_string(htmlentities(trim($_POST['rate_2_name_find'])));
$rate_3_find = mysql_real_escape_string(htmlentities(trim($_POST['rate_3_name_find'])));
$rate_4_find = mysql_real_escape_string(htmlentities(trim($_POST['rate_4_name_find'])));
$pros = mysql_real_escape_string(htmlentities(trim($_POST['pros'])));
$cons = mysql_real_escape_string(htmlentities(trim($_POST['cons'])));
//add_post_meta('17', 'ff_value', "ff", true);
$rating_insert = mysql_query("INSERT INTO wp_rating (post_id, rating_1, rating_2,rating_3,rating_4,user_id,comment_id,pc_ip,pros,cons)
VALUES (".$p_id.", ".$rate_1.", ".$rate_2.",".$rate_3.",".$rate_4.",".$user_id.",".$comment_id.",'".$pc_ip."','".$pros."','".$cons."')");
//$multi_in = multiRatingWidth($p_id, $rating_cat_numbers, $rate_1_find, $rate_2_find, $rate_3_find, $rate_4_find);
die();
}
add_action('wp_ajax_updateRating', 'implement_ajax_updateRating');
add_action('wp_ajax_nopriv_updateRating', 'implement_ajax_updateRating');
But alert is returning -1 & nothing is saved in database.