JavaScript
|
|
 |
 | google map splite write problem |  | chogrf | 2:48 13 Sep '12 |
|
 |
iframe
width="3000"
height="3000"
/iframe
i made iframe for google big image
1. i would like to move 3000 pixel to pan above with javascript , no google api
2. i would like to split save image with java because big image save error
no capture utill
|
|
|
|
 |
 | Fastest way to select all elements in a *ListBox* |  | A***** | 19:32 12 Sep '12 |
|
 |
I am trying to select all the elements in a Listbox/SelectBox.
At the moment I am using the following function *which is working*, the only thing is it takes around 10 seconds to select all elements(of which there are 652).
I'm a beginner at javascript so I was wondering whether anyone knew of a faster way to select all elements.
<script>
function selectAll(selectBox, selectAll, ensureOneSelected) {
var selectBoxElement = null;
var selectBoxOption = null;
var boolSelect = selectAll;
if (typeof selectBox == "string") {
selectBoxElement = document.getElementById(selectBox);
selectBoxOption = selectBoxElement.options;
}
if (selectBoxElement.type == "select-multiple") {
var max = (selectBoxOption.length);
var modMaxUnrollFactor = (max % 4);
max -= modMaxUnrollFactor ;
for(var i = 0; i < max; i+=4){
selectBoxOption[i].selected = boolSelect;
selectBoxOption[i + 1].selected = boolSelect;
selectBoxOption[i + 2].selected = boolSelect;
selectBoxOption[i + 3].selected = boolSelect;
}
for (var i = max; i < selectBoxOption.length; i++) {
selectBoxOption[i].selected = boolSelect;
}
if (typeof ensureOneSelected == "boolean") {
if(selectBoxOption[0].selected == false)
{
selectBoxOption[0].selected = ensureOneSelected;
}
}
}
}
</script>
thanks in advance
|
|
|
|
 |
|
 |
What is with the unroll factor and two loops? That is pointless ... running a for loop 600 times isn't what's slow.
Manipulating the DOM can be slow. You might do better to get .innerHTML, do a regex replace for '<option( selected)?' with either '<option' or '<option selected', and then reassign .innerHTML.
|
|
|
|
 |
|
 |
BobJanova wrote: Manipulating the DOM can be slow. You might do better to get .innerHTML, do a
regex replace for '<option( selected)?' with either '<option' or
'<option selected', and then reassign .innerHTML.
Thanks, I'll look into it.
BobJanova wrote: What is with the unroll factor and two loops? That is pointless ... running a
for loop 600 times isn't what's slow.
I'm a c/c++ programmer predominately, force of habit
|
|
|
|
 |
|
 |
Developed a working solution on IE8 though I did run into a select option truncate bug where the first option in innerHTML is removed.
But in the end I developed a workaround for this bug and have a working hack solution which is much much faster, so all is good.
cheers.
|
|
|
|
 |
 | javascript _> activex passing by reference |  | Johan0001 | 1:40 12 Sep '12 |
|
 |
Hi I hope somebody can help. Apologies if the code below is not clear ,because this is my first post/query. Basically i have a javascript function that is executed on the client side using onclientclick in my aspx , html page. The javascript function "capt(fingerpos)" below invokes the activex objects which is declared in the aspx page in an object tag( see below).It is also registered in the client machine. All the method calls work correctly , until i need to pass an array ( buf) by reference to the method CSDCtrlClass.GetMemoryBuffer("BMP", buf); This always returns an empty array . Ive tried declaring an object (BmpObject) and sending it to the activex method with the same result. In c#( windows application) this com object works correctly when declaring BmpObject as object , and the return value of (buf) is populated by the activex method CSDCtrlClass.GetMemoryBuffer("BMP", buf); My problem is i cannot understand why this method does not return the buffer/object in javascript , but does work in a normal windows application. Obviously the handeling of the reference variable( either array or object) is different in javascript. But i have tried many different approaches , the return variable is always the same ( empty or null). Any suggestions on how to handle this? The actual return data is just a block of 8 bit bytes( bmp image) when executed in the working windows application.
html code snippet:
<object id="CSDCtrlClass" name="CSDCtrlClass"classid="CLSID:B228B13B-AD31-4523-AD58-5D52553EEC47" width="100" height="100"></object> <script type ="text/javascript">
function capt(FingPos) { var BmpObject = {}; var buf = new Array(200000); CSDCtrlClass.InitScannerExternal(); CSDCtrlClass.bInitKillScannerExternal = 1; CSDCtrlClass.bAutoCapture = 1; CSDCtrlClass.OutputFileMode = 0; CSDCtrlClass.TransNo = "TranSample"; CSDCtrlClass.FingPos = FingPos; CSDCtrlClass.OutputSaveFormat= "BMP_RAW_WSQ"; CSDCtrlClass.Capture(); if (CSDCtrlClass.ErrCode == -999) { alert("Capture Error:" + CSDCtrlClass.ErrCode); return false; } try { CSDCtrlClass.GetMemoryBuffer("BMP", buf); if (CSDCtrlClass.ErrCode != 0) { alert("Capture Error:" + CSDCtrlClass.ErrCode); return false; } alert(buf); CSDCtrlClass.TerminateScannerExternal(); } catch (err) { var txt = ""; txt = "ERROR[" + err.message + "]"; alert(txt); }
</script>
|
|
|
|
 |
|
 |
Hi
I'm hoping to set up a system similar to Google Adwords that allows
other sites to extact a limited amount of data from my site, and
display it as part of their webpage. Google use a javascript file:
show_ads.js with parameters.
Can anyone explain how the .js file works? In particular how does it
output HTML back to the calling site, and how does it access the
parameters?
|
|
|
|
 |
|
 |
Seriously?
Two identical posts (with different titles) posted just 1 minute apart. I'd love to understand the motive behind such a move.
On a different note, you could probably do worse than visit http://jsbeautifier.org/[^]
You can paste the contents of show_ads.js into the window, hit the button, then see the code de-minified.
The variable names still suck - since they've been squished down to 1 or 2 letters long, but at least it makes it readable now.
If I were doing it, I'd probably save a page to disk that I knew used the file. I would then de-minify the javascript file and save it with a new name. I'd then change the saved-copy of the html so that it referenced the de-minified file.
Now that you have a local copy that references a human-readable file, I'd open it in a browser, place a break-point in the JS file and hit re-load. You should then be able to step-through execution of the code. This may be the easiest way of understanding it since all the variable names screwed-up.
Good luck!
Make it work. Then do it better - Andrei Straut
|
|
|
|
 |
|
 |
Hi
I'm hoping to set up a system similar to Google Adwords that allows
other sites to extact a limited amount of data from my site, and
display it as part of their webpage. Google use a javascript file:
show_ads.js with parameters.
Can anyone explain how the .js file works? In particular how does it
output HTML back to the calling site, and how does it access the
parameters?
|
|
|
|
 |
 | How to send request data from one tab to other tab which are on same jsp |  | mayureshdh | 18:52 9 Sep '12 |
|
 |
I want to send the data which coming through request object on one tab to other tab.both tabs are on same jsp.how i can do it??
|
|
|
|
 |
|
|
General
News
Suggestion
Question
Bug
Answer
Joke
Rant
Admin