|
If you are having this button in popup, then it would not be possible to get control of main windows once you close this popup right.
So my suggestion would be to have a js file common to both main window and popup.
And have a js function in it to close the child window and then trigger update on main window.
On click of add to cart button, trigger this function.
Hope this should be helpful.
|
|
|
|
|
Thank you for the help - if you had some code that would help me please let me know - thanks
|
|
|
|
|
First thing you'll need is to store the reference of the popup window.
Then you can use it to close the popup and refer to window.location object for updating the page as shown below.
var childWin = window.open(url,name,params)
function closeWindow()
{
childWin.close();
window.location.href = "<new url>";
document.getElementById("divId").innerHTML = "<updated html>";
}
If you want to just update a part of the page, then you can handle it through the DOM objects (document).
|
|
|
|
|
here is my complete add to cart code:
<form class="cart" action="index-shop.php" method="post"><input type="hidden" name="my-item-id" value="book 1" /><input type="hidden" name="my-item-name" value="book 1" /><input type="hidden" name="my-item-price" value="35.00" /><input type="hidden" name="my-item-url" value="http://www.amazoni.![enter image description here][1]com" />Qty: <input type="text" name="my-item-qty" value="1" size="3" /><input class="button" type="submit" name="my-add-button" value="add to cart" /></form>
|
|
|
|
|
I won't be able to change this code.
You can get detailed information here.
|
|
|
|
|
better if you stay on current window. Use jquery dialog for this kind of scenario.
html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#cart" ).dialog();
});
</script>
</head>
<body>
<div id="cart" title="Basic dialog">
<p>Use cart item to add in cart list.</p>
</div>
</body>
|
|
|
|
|
Yes, this should work as well.
|
|
|
|
|
can i send the email by javascript on html web form.
|
|
|
|
|
Your javaScript would have to call a webservice because JS executes on the client machine so it cannot send email. You can use the jQuery library and call .ajax() to call your webservice to send the email.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I recently added tinymce to a site I'm developing, and other javscript code appears to have stopped working as a result. Is there an easy way to find conflicts that could cause problems?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I use Internet Explorer, the F12 Key.
IE11 F12 is pretty slick now, You choose the debug mode, the icon of a bug, load your page, and the cursor in the F12 box will stop on error, and give you an idea of the error. to continue, right click and choose "Run to Cursor"
Some of the messages are vague, so then you just search the message text for an answer.
For stuff I write, I run it through JavaScript Lint, to check for errors.
[Online Lint^]
|
|
|
|
|
|
Ummmm, wake up. This thread is six months old.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
This is a piece of the code I'm working with and the only part giving me problems. I'm using the combo box to give me both the Line2_flag and the screencharge. Without this particular piece of code the form works fine so I know it's just this snippet. Any help is appreciated. Thanks!
<select name="inkcolors" size="1" id="inkcolors" class="FormStyle"
<option selected value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
var = Line2_flag;
var = screencharge;
if(form.inkcolors[1].selected){
Line2_flag = 1.75;
screencharge = 1;
}
if(form.inkcolors[2].selected){
Line2_flag = 2.25;
screencharge = 2;
}
if(form.inkcolors[3].selected){
Line2_flag = 2.75;
screencharge = 3;
}
|
|
|
|
|
You may like to explain what the problem is.
Veni, vidi, abiit domum
|
|
|
|
|
Sorry I wasn't clearer, but I did receive my answer on another site so I will post it here in case it helps.
<html>
<form>
<select name="inkcolors" size="1" id="inkcolors" class="FormStyle"
<option selected value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</form>
<script>
var Line2_flag = null;
var screencharge = null;
var field = document.forms[0].elements['inkcolors'];
var selected = field.options[field.selectedIndex].value;
if (selected === "1") {
Line2_flag = 1.75;
screencharge = 1;
} else if (selected === "1") {
Line2_flag = 2.25;
screencharge = 2;
} if (selected === "3") {
Line2_flag = 2.75;
screencharge = 3;
}
</script>
</html>
|
|
|
|
|
All well and good but you still did not explain what the original problem actually was.
Veni, vidi, abiit domum
|
|
|
|
|
Are you sure this is right?
You're checking for selected === "1" a second time in the else if , so the middle section will never execute.
|
|
|
|
|
hello,
i am mahesh kadtan student of BE IT . for last yr project i`m developing "EDP management system" it has front end JSP and back end oracle 10g my source code run correctly on tomcat server, with the help of local host i.e loop back address. now my project guide told me to use 2 different PC one is for front end and another one is for back end BUT i have no clue how to connect two pc using connection string . i have basic knowledge i.e i have to put my IP instead of local host n so on. BUT full procedure how to set up client-server connection and how can i connect 2 different system using a connection string
here is my soure code:-
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
out.println("hello" );
Connection con = DriverManager.getConnection("jdbc:odbc:EDP","scott","tiger");
edp :- DSN name
scott:- DB username
tiger:- DB password
so plz post ur valuable commt with full procedure so that i can complete my BE project
with best regard
mahesh kadtan
|
|
|
|
|
If you're in your final year, you should have learned the difference between Java[^] and JavaScript by now. Aside from a vaguely similar syntax, there's no connection between the two.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Hi guys. I do not know JS / AJAX / Web tech, I just need plain and simple mechanism for multiple files upload.
Currently I have this (taken from the net actually):
function uploader(place, targetPHP)
{
this.drop = function(event)
{
event.preventDefault();
var dt = event.dataTransfer;
var files = dt.files;
var progressBar = document.querySelector('progress');
for (var i = 0; i < files.length; i++)
{
var file = files[i];
xhr = new XMLHttpRequest();
xhr.open('POST', targetPHP, false);
xhr.setRequestHeader('UP-FILENAME', file.name);
xhr.setRequestHeader('UP-SIZE', file.size);
xhr.setRequestHeader('UP-TYPE', file.type);
xhr.onreadystatechange = function()
{
if(this.readyState == 4 && this.status == 200)
{
progressBar.value = Math.round((i * 100) / files.length);
}
}
xhr.send(file);
}
progressBar.value = 100;
setTimeout("location.reload(true);", 2000);
}
this.uploadPlace = document.getElementById(place);
this.uploadPlace.addEventListener("dragover", function(event)
{
event.stopPropagation();
event.preventDefault();
}, true);
this.uploadPlace.addEventListener("drop", this.drop, false);
}
This thing uploading files synchronously one by one but it makes a browser, such as IE for example, freezes. I need to modify
this script the way it will be doing same but asynchronously. So it will upload one file, then in onreadystatechange event
it will trigger next file upload. This is because my server is a 2 threaded application, which processes XMLHttpRequest one by one.
Basically, I got no idea how to modify this script that way because I do not know js / ajax at all.
I was trying to collect files into an array, which was a class member, and then process them but uploader just stopped
after first file upload.
Thanks in advance.
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
Responding to my own question but it seems like I was messing around with this keyword in an inappropriate way. Correct code for sequential async file uploader goes like this:
function XMLHttpUploader(place, targetPHP)
{
upload = function (currentArray, arrayTotalSize) {
var currentFile = currentArray.shift();
if (currentFile) {
var xhr = new XMLHttpRequest();
xhr.open('POST', targetPHP, true);
xhr.setRequestHeader('UP-FILENAME', currentFile.name);
xhr.setRequestHeader('UP-SIZE', currentFile.size);
xhr.setRequestHeader('UP-TYPE', currentFile.type);
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var progressBar = document.querySelector('progress');
if (progressBar) {
progressBar.value = Math.round(((arrayTotalSize - currentArray.length) * 100) / arrayTotalSize);
}
upload(currentArray, arrayTotalSize);
}
}
xhr.onerror = function () {
alert('File transfer failed!');
}
xhr.send(currentFile);
}
else {
var progressBar = document.querySelector('progress');
if (progressBar) {
progressBar.value = 100;
setTimeout("location.reload(true);", 2000);
}
}
}
this.drop = function(event)
{
event.preventDefault();
var currentArray = new Array();
for (var i = 0; i < event.dataTransfer.files.length; i++) {
currentArray.push(event.dataTransfer.files[i]);
}
upload(currentArray, currentArray.length);
}
this.uploadPlace = document.getElementById(place);
this.uploadPlace.addEventListener("dragover", function(event)
{
event.stopPropagation();
event.preventDefault();
}, true);
this.uploadPlace.addEventListener("drop", this.drop, false);
}
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
<script type="text/javascript">
function doClick(btnSearch, e) {
//the purpose of this function is to allow the enter key to
//point to the correct button to click.
var key;
if (window.event)
key = window.event.keyCode; //IE
else
key = e.which //firefox
if (key == 13) {
//Get the button the user wants to have clicked
//var btn = document.getElementById(<%=btnSearch.ClientID%>);
var btn = $get(btnSearch);
<%--var b = document.getElementById('<%=btnSearch.ClientID%>');--%>
if (btn != null) { //If we find the button click it
btn.click();
event.keyCode = 0
}
}
}
</script>
|
|
|
|
|
Where is the code that calls doClick?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|