|
Hi All,
I am using javascript to create a ActiveXObject. It runs well in one system. but after host it in IIS 7, when i run it from other computers ( http://ipaddress/sitenm) it can not create a ActiveXObject.
|
|
|
|
|
you are most likely running into security errors.
what exactly is the error you are creating when trying to create it??
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Thank u very much. There is no any error message, it runs well, problem is that it cant create ActiveX Obect. i tested the javascript code by giving alert message, the alert messages are comming, but the .exe which i am trying to call througt ActiveX Obeject cant create. i already done with all the settings in Internet Option in IE. (it runs well in one system and ActiveX Object is also created, but when i am trying to access it from other system it unable to create)
|
|
|
|
|
either,
a. ActiveXObject exists on the other machine but it hasn't been registered (using regsvr32)
or
b. ActiveXObject isn't on the remote machine at all and can't be registered until it does exist there
|
|
|
|
|
Hi All,
I am trying to send the value of the ID or Name attribute of an html form to ASP.net when the form button is clicked. Normally I would send data using textboxes, checkboxes, or radio buttons. I can also send values through the url but that is not safe. All I want to have on a form is the button and when it is clicked, send the value of the form's id attribute or form's name attribute to asp.net. The value of the id or name attribute will be generated using javascript at run time and not seen before the button on the form is clicked. Please give an example if you can, thanks in advance.
modified 7-Jun-13 23:26pm.
|
|
|
|
|
First this question is probably best posted in the ASP Forum.
I am assuming that the button is an <asp:Button .../> and that you are handling that in a POST. If that is the case my recommendation would be stuff the value a textbox whose value is server readable. I might be entirely wrong but I believe the form tag is server rendered in ASP.Net in which case you don't want to mess with the name or the id because it could have a negative impact on the page gets marshaled back into code on the server.
As I said in the beginning this question is best if posted in ASP Forum.
Best luck.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Hi, thanks for your reply. Can't the button be a regular HTML button that uses a javascript function to send the values of the id or name attribute?
|
|
|
|
|
ASPnoob wrote: Can't the button be a regular HTML button that uses a javascript function to send the values...
Yes.
Again more directed towards the ASP.Net forum. The following article should help you get you started in the right direction towards what you are looking to do.
Calling Server Side Code from Client Side using Ajax[^]
Best of luck.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Here's the code I ended up with (explanation follows code).
HTML (you may have to adjust for the versions of jquery and modernizr you're using):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="../Scripts/modernizr-2.6.2.js"></script>
<script type="text/javascript" src="../Scripts/jquery-2.0.0.js"></script>
<script type="text/javascript" src="TreeOfHope/jscripttest.js" ></script>
</head>
<body>
<div id="canvasesDiv" style="position:relative; width:490px; height:356px; border:1px solid black; background-color:silver;"></div>
<div id="testImage" style="width:490px; height:356px; border:1px solid black; background-color:silver;">
<img src="http://paddedwall.org/2012mustang/images/blacklights_03.jpg" width="490px" height="356px;" alt="" />
</div>
<script type="text/javascript" >
$(document).ready(function()
{
doIt();
});
</script>
</body>
</html>
Javascript (jscripttest.js):
function doIt()
{
var _filename = "http://paddedwall.org/2012mustang/images/blacklights_03.jpg";
var _divName = "#canvasesDiv";
var _sceneWidth = $(_divName).width();
var _sceneHeight = $(_divName).height();
var _scaleX = 1.0;
var _scaleY = 1.0;
var _canvas = null;
var _context = null;
var _image = $('<img />')
.attr(
{
'id' : 'backgroundImage',
'src' : _filename
})
.css(
{
'-ms-interpolation-mode' : 'bicubic',
'image-rendering' : 'optimizeQuality'
})[0];
$(_image).load(function()
{
if (this.complete === true)
{
Continue($(this)[0].naturalWidth, $(this)[0].naturalHeight)
}
});
this.Continue = function(imgWidth, imgHeight)
{
_scaleX = _sceneWidth / imgWidth;
_scaleY = _sceneHeight / imgHeight;
_canvas = $("<canvas>Not html5-compatible</canvas>")
.css(
{
'position': 'absolute'
,'top' : 0
,'left' : 0
,'z-index' : 0
,'display' : 'inline'
})
.attr(
{
'id' : 'backgroundCanvas'
,'width' : _sceneWidth+"px"
,'height' : _sceneHeight+"px"
});
$(_divName).append($(_canvas)[0]);
_context = $(_canvas)[0].getContext('2d');
_context.setTransform(_scaleX, 0, 0, _scaleY, 0, 0);
_context.drawImage(_image, 0, 0);
}
}
The first problem was determining the actual "natural" size of the image. I had to put a call to subsequent code inside the call to image.load .
The second problem involved scaling the image to fit the desired size. Originally, I was using the jquery object's css() method to set the size of the canvas. When you do it that way, the canvas does not properly transform/scale. You MUST set the width and height as attributes in order to get scaling to work correctly.
Maybe this will help someone else in the future.
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
very cool... you should write an article on this.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Hello all,
How to invoke Code behind method and java script function
on check box change event
|
|
|
|
|
sujeet321 wrote: How to invoke Code behind method and java script function on check box change event
I am not sure what you meant by code behind... I am guessing ASP.NET in which case I would recommend you post this question in that forum.
I wrote this[^] quick sample on jsFiddle which does a simple jQuery setup to handle when a checkbox is selected.
http://jsfiddle.net/xehmr/[^]
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Hi, i have a problem.
i want to send a callback function with params.
and every time to send different params.
the problem is that the callback function recive all the time
the same values of the last iteration of the loop-
how can i solve this problem?
thnks!
function B(a,b)
{
alert(a + b);
}
function A()
{
for(var i = 0;i < Z ; i++)
{
for(var j = 0;j < Z ; j++)
{
var temp = function() {return function(){B(i,j)}};;
func(temp);
}
}
}
|
|
|
|
|
So where is func defined? where is Z defined?
What is your code supposed to do exactly?
here's some code.
function add(a,b)
{
alert(a + b);
}
function mult(a,b)
{
alert(a * b);
}
var o = { func : function(f, x,y) { return f(x,y); }};
function A(Z)
{
for(var i = 0;i < Z ; i++)
{
for(var j = 0;j < Z ; j++)
{
o.func(add, i,j);
}
}
} .
|
|
|
|
|
I would think you could debug and step through and see what is happening.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
When I define Z and func , the code runs, but B is never called. You have to provide a complete example.
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
hi to all
i written some code for toggle between textbox and textare
but when my textbox convert to multi line(textarea) it cant be convert to input text again how can i do this
my html:
<form id="form1" runat="server">
<asp:TextBox ID="txt" runat="server" Text="11111111111111111111111111111"></asp:TextBox>
<table class="auto-style1">
<tr>
<td>
<asp:TextBox ID="txt0" runat="server" Text="222222222222222222222222"></asp:TextBox>
</td>
</tr>
<tr>
<td><asp:TextBox ID="TextBox1" runat="server" Text="333333333333333333333333333"></asp:TextBox></td>
</tr>
<tr>
<td><asp:TextBox ID="TextBox2" runat="server" Text="44444444444444444444444444444444444"></asp:TextBox></td>
</tr>
<tr>
<td><asp:TextBox ID="TextBox3" runat="server" Text="5555555555555555555555555555555555555555"></asp:TextBox></td>
<td> </td>
</tr>
<tr>
<td><asp:TextBox ID="TextBox4" runat="server" Text="66666666666666666666666666666666666666666666"></asp:TextBox></td>
</tr>
</table>
</form>
$(function () {
$(':input').click(function () {
var newTextArea = document.createElement('TextArea');
this.parentElement.appendChild(newTextArea);
debugger
newTextArea.name = $(this)[0].id;
newTextArea.value = $(this)[0].defaultValue;
newTextArea.onclick = function () {
var newtext = document.createElement('input');
newtext.value = this.innerText;
newtext.name = this.name;
this.parentElement.appendChild(newtext);
$(this).remove();
}
$(this).remove();
})
});
thanks in advance
|
|
|
|
|
I'm still having problems:
0) The code will not get the width of the _image .
1) This in turn causes _scale to be "Infinity" (because _imageWidth is 0 when I try to do the division to determine _scale 's value
2) Finally, the _context isn't drawing the _image .
If you want to try the code, I'm using jQuery 2.0 (prior versions back to 1.83 should work fine). Other than that, it's completely self-contained.
<body>
<div id="canvasesDiv" style="position:relative; width:416px; height:512px; border:1px solid black; background-color:silver;"></div>
</body>
function doIt()
{
var _filename = "http://paddedwall.org/2012mustang/images/blacklights_03.jpg";
var _divName = "#canvasesDiv";
var _sceneWidth = $(_divName).width();
var _sceneHeight = $(_divName).height();
var _imageWidth = 0;
var _image = $('<img />').attr({'id': 'backgroundImage', 'src' : _filename})[0];
$(_image).load(function()
{
if (this.complete === true)
{
_imageWidth = this.width;
if (_imageWidth === 0)
{
_imageWidth = _sceneWidth;
}
}
});
var _scale = _sceneWidth / _imageWidth;
var _canvas = $("<canvas>Not html5</canvas>");
$(_canvas).css('width', _sceneWidth);
$(_canvas).css('height', _sceneHeight);
_canvas.attr('id', "backgroundCanvas");
_canvas.css('width', _sceneWidth);
_canvas.css('height', _sceneHeight);
_canvas.css('position', 'absolute');
_canvas.css('top', 0);
_canvas.css('left', 0);
_canvas.css('z-index', 0);
_canvas.css("display", "block");
$(_divName).append($(_canvas)[0]);
var _context = $(_canvas)[0].getContext('2d');
_context.setTransform(1, 0, 0, 1, 0, 0);
_context.scale(_scale, _scale);
_context.drawImage($(_image)[0], 0, 0);
}
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I'm sure you are aware that the function you fed to the images load method will be executed when the image loads. This happens asynchronically. The rest of the doIt method may well be executed before the image had a chance to load. Try moving everything after var _scale = _sceneWidth ... into the anonymous method in the image's load method call.
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
I've already tried that - the image.width property is still 0.
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I'm not particularly familiar with the <canvas> tag, but I can see why your _imageWidth is zero: the load(function(){ ... }) method is adding the function as a handler to the image's load event. It won't get called until the image has loaded, which won't happen immediately.
Try putting the rest of your code in the callback:
function doIt()
{
var _filename = "http://paddedwall.org/2012mustang/images/blacklights_03.jpg";
var _divName = "#canvasesDiv";
var _sceneWidth = $(_divName).width();
var _sceneHeight = $(_divName).height();
$('<img />').attr({'id': 'backgroundImage', 'src' : _filename}).load(function()
{
if (this.complete === true)
{
var _imageWidth = this.width;
if (_imageWidth === 0)
{
_imageWidth = _sceneWidth;
}
var _scale = _sceneWidth / _imageWidth;
var _canvas = $("<canvas>Not html5</canvas>");
_canvas.css('width', _sceneWidth);
_canvas.css('height', _sceneHeight);
_canvas.attr('id', "backgroundCanvas");
_canvas.css('width', _sceneWidth);
_canvas.css('height', _sceneHeight);
_canvas.css('position', 'absolute');
_canvas.css('top', 0);
_canvas.css('left', 0);
_canvas.css('z-index', 0);
_canvas.css("display", "block");
$(_divName).append(_canvas[0]);
var _context = _canvas[0].getContext('2d');
_context.setTransform(1, 0, 0, 1, 0, 0);
_context.scale(_scale, _scale);
_context.drawImage(this, 0, 0);
}
});
}
http://jsfiddle.net/hXqMG/[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's exactly what I meant.
I'm not sure though that load will happen if the node JSOP constructed is not added to the DOM yet.
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
It seems to work in the jsFiddle I linked to, at least in Firefox.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for the information Richard!
I should try that one in other browsers as well.
[Modified]Works in IE 10 as well[/Modified]
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
It also appears to work in Chrome 29, Opera 12.15 and IE10.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|