|
Is it necessary to postback your form? Can it be done via ajax? Otherwise the only way is to persist the node somewhere, viewstate, session, etc. and reattach during rendering.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
yes it is doing it by ajax control toolkit and would require quite a bit of rework to make it to have a server side controller instead of a postback to the page.
i'm thinking of persisting it as a cached DOM object in the browser. Because it's containing DOM element stays, i can clone the removed DOM element (which is a panel) and reattach it to the same node.
my 2 issues are:
1) cloning a DOM object, there doesn't seem to be a raw javascript code that handles. the framework i am using doesn't have it either.
2) trapping the event that fires when the postback response is rendered to the DOM. (adding a listener to the element that causes the postback in the first place is the easy part).
thanks for spending some time thinking about my problem.
----------------------------------------------------------
Lorem ipsum dolor sit amet.
|
|
|
|
|
1) JQuery .clone()[^]
2) AJAX toolkit only gets you so far. Handling the ajax calls yourself gives you the flexibility to do this.
ajaxComplete()[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
Working in Acrobat 9.0 forms (not LiveCycle). Have a push button ("MKTGlaunch") to launch a new form from the currently open form. I want to make a check box on the 'parent' form to indicate that the button has been pushed. (i.e. If the button is pushed, program puts a check in the box.)
What is the best way to indicate the action of the button? On the "Mouse Up" there’s already a JS to tell the program to launch the new form, using the "Open a Web Link."
I tried adding a "Run JavaScript" onto another Mouse Up, but nothing happens. I've also tried putting it on the "Mouse Down," but that doesn't work.
But perhaps I'm using the wrong syntax? I'm very much a beginner. This is what I'm using for the Mouse Up/Down:
var MKT = this.getField("MKTGlaunch");
this.getField(MKT.isBoxChecked(0) == true);
Can you give me a push in the right direction?
Is there a better way to do this?
|
|
|
|
|
I don't really understand what the Acrobat 9.0 forms has to do with anything, but if you are just attempting to check a box on the mouseup event, try:
function mouseUpFunc() {
document.getElementById('MKTGlaunch').checked = true;
} And the associated HTML contains something like:
<input type="checkbox" id="MKTGlaunch" />
<input type="button" onclick="mouseUpFunc();" /> Hope this helps!
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
hi guys. i have loop which needs to attach event on some elements. event must fire function and pass value from within loop. so here is problem... when loop is over all events fire same argument that is passed by ref not value at that time.
<a href="#">link 1</a>
<a href="#">link 2</a>
<a href="#">link 3</a>
<script type="text/javascript">
var anchorNiz = document.getElementsByTagName("a");
for(var i=0;i<anchorNiz.length;i++){
var anchor = anchorNiz[i];
anchor.attachEvent("onmouseover",function(){alert(i)});
//this line does same thing, different value
//anchor.attachEvent("onmouseover",function(){alert(anchor)});
}
//the idea is to set links to fire ordinal number, but all are fireing '3'
</script>
|
|
|
|
|
you will get 0, 1 and 2
<a href="#">link 1</a>
<a href="#">link 2</a>
<a href="#">link 3</a>
<script type="text/javascript">
var anchorNiz = document.getElementsByTagName("a");
for(var i=0;i<anchorNiz.length;i++){
var anchor = anchorNiz[i];
anchor.attachEvent("onmouseover",(function(){
var arg = arguments[0];
return function(){
alert(arg);}})(i))
}
</script> also attachevent omly works in IE
modified on Tuesday, September 14, 2010 2:24 PM
|
|
|
|
|
thx. very interesting solution....
|
|
|
|
|
I want to use jQuery and jTemplates to display information returned via a webservice.
The code I am trying is:
function InsertAfter(RowID, json) {
var thisTable = document.getElementById("myTable");
var newRow = thisTable.insertRow(GetRowIndex(RowID));
newCell = newRow.insertCell(0);
newCell.colspan = '3';
newID = RowID + 'Results';
newCell.id = newID;
var template = $('#jTemplateResultsRow').html();
var item = $('#' + newID);
item.setTemplate(template);
item.processTemplate(json);
}
Everything goes fine til I get to the item.setTemplate(template); . Then I get a Microsoft JScript runtime error: Object doesn't support this property or method error.
I have double checked that both the jQuery and jTemplates libraries are loaded and that there are no conflicting javascript templates/frameworks/etc that are referenced.
Both the template and item get set to valid values.
Does anyone have any ideas or suggestions that could help?
---------------------------------------------------------------------
The issue was with the web service returning a nested json string.
All now works
modified on Wednesday, September 22, 2010 12:33 AM
|
|
|
|
|
You need to debug the javascript to see that template and item are both valid items. Depending on the development environment you are using, I tend to just put a debugger; statement in to force the app into the script debugger.
|
|
|
|
|
Thanks Pete,
I fixed this problem a couple of days ago, but forgot to update here.
The issue was mostly that the web service was returning a string with json inside json.
When I figured that out, it all just worked!
|
|
|
|
|
RCoate wrote: When I figured that out, it all just worked!
Good job
|
|
|
|
|
Hi,
Please verify item object which is set or not like set the debug point on following line
item.setTemplate(template);
and see whether item has any value if not then the problem is in following line
var item = $('#' + newID);
Thanks
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
what is the best way to protect your javascript IP from being snatched and used without your permission? do you obfuscate, encrypt/decrypt your client side javascript?
thanks!
----------------------------------------------------------
Lorem ipsum dolor sit amet.
|
|
|
|
|
Obfuscate the client side scripting.
Here is an example site for doing just that;
http://www.javascriptobfuscator.com/[^]
I ran some code through and here is the example input and output;
function save_options() {
var currentID = localStorage["memberID"];
var newID = textMemberID.value;
if (!(currentID == newID)) {
localStorage["memberID"] = newID;
if (localStorage["memberID"] == newID) {
save_status.innerHTML = "MemberID: " + localStorage["memberID"] + " saved to local storage.";
setTimeout(function () { save_status.innerHTML = ""; }, 1000);
var newRep = new Array();
for (i = 0; i < 9; i++) {
newRep[i] = "0";
}
setNewRepDetail(newRep);
clearTable();
reload_Page();
}
else
{ save_status.innerHTML = "Error saving MemberID to localStorage."; }
}
else {
save_status.innerHTML = "MemberID: has not changed.";
setTimeout(function () { save_status.innerHTML = ""; }, 1000);
}
}
Output;
var _0x9c0d=["\x6D\x65\x6D\x62\x65\x72\x49\x44","\x76\x61\x6C\x75\x65","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x4D\x65\x6D\x62\x65\x72\x49\x44\x3A\x20","\x20\x73\x61\x76\x65\x64\x20\x74\x6F\x20\x6C\x6F\x63\x61\x6C\x20\x73\x74\x6F\x72\x61\x67\x65\x2E","","\x30","\x45\x72\x72\x6F\x72\x20\x73\x61\x76\x69\x6E\x67\x20\x4D\x65\x6D\x62\x65\x72\x49\x44\x20\x74\x6F\x20\x6C\x6F\x63\x61\x6C\x53\x74\x6F\x72\x61\x67\x65\x2E","\x4D\x65\x6D\x62\x65\x72\x49\x44\x3A\x20\x68\x61\x73\x20\x6E\x6F\x74\x20\x63\x68\x61\x6E\x67\x65\x64\x2E"];function save_options(){var _0xa035x2=localStorage[_0x9c0d[0]];var _0xa035x3=textMemberID[_0x9c0d[1]];if(!(_0xa035x2==_0xa035x3)){localStorage[_0x9c0d[0]]=_0xa035x3;if(localStorage[_0x9c0d[0]]==_0xa035x3){save_status[_0x9c0d[2]]=_0x9c0d[3]+localStorage[_0x9c0d[0]]+_0x9c0d[4];setTimeout(function (){save_status[_0x9c0d[2]]=_0x9c0d[5];} ,1000);var _0xa035x4= new Array();for(i=0;i<9;i++){_0xa035x4[i]=_0x9c0d[6];} ;setNewRepDetail(_0xa035x4);clearTable();reload_Page();} else {save_status[_0x9c0d[2]]=_0x9c0d[7];} ;} else {save_status[_0x9c0d[2]]=_0x9c0d[8];setTimeout(function (){save_status[_0x9c0d[2]]=_0x9c0d[5];} ,1000);} ;} ;
|
|
|
|
|
Yeah - and anyone can go to sites such as this[^] , or google elsewhere, and de-obfuscate it again.
It might be good for compression purposes, but you'd be an idiot to try hiding aything really imprtant in it, and a fool if you think your IP will be protected because of it.
Short answer tot eh OP's question is: you can't, so don't bother. The longer one is: why do you want to, really? Is there anything in your code that is so mind-blowing, and hasn't been done before, that you just have to stop anyone else from seeing it? Or learning from it...
|
|
|
|
|
Obfuscation is only good for deterring the casual code browser. I totally accept that.
|
|
|
|
|
Here is the code....it works fine on mozilla but on IE clearInterval doesn't work,,...
<br />
<html><br />
<head><br />
<style type="text/css"><br />
.imgf{width:300px; height:250px;}<br />
#img2{z-index:1000;}<br />
</style><br />
<script language="javascript"><br />
window.onload=inItAll;<br />
var j=0;<br />
var N=2;<br />
function inItAll()<br />
{<br />
document.getElementById("img1").onclick=click;<br />
}<br />
<br />
function click()<br />
{<br />
if(navigator.appName=="Netscape")<br />
{<br />
j=0.9;<br />
setInterval("fadeN()",40);<br />
<br />
}<br />
else<br />
{<br />
j=90;<br />
var fI = setInterval("fadeI()",40);<br />
}<br />
<br />
}<br />
<br />
function fadeN()<br />
{<br />
j=j-0.1<br />
<br />
if(j>0.4)<br />
{ <br />
<br />
document.getElementById("img1").style.opacity= j;<br />
}<br />
else<br />
{<br />
j=0.4;<br />
window.clearInterval();<br />
<br />
document.getElementById("img1").src = "images/"+2+".jpg";<br />
<br />
setInterval("showN()",40);<br />
<br />
} <br />
<br />
}<br />
<br />
function showN()<br />
{<br />
<br />
if(j<1)<br />
{<br />
document.getElementById("img1").style.opacity= j;<br />
j=0.1 + j;<br />
<br />
}<br />
else<br />
{<br />
window.clearInterval();<br />
document.getElementById("img1").style.opacity= 1;<br />
<br />
}<br />
}<br />
<br />
function fadeI()<br />
{<br />
j=j-10<br />
<br />
if(j>40)<br />
{ <br />
document.getElementById("img1").style.filter ="alpha(opacity="+j+")";<br />
<br />
}<br />
else<br />
{<br />
j=40;<br />
window.clearInterval(fI);<br />
<br />
document.getElementById("img1").src = "images/2.jpg";<br />
<br />
var sI = setInterval("showI()",40);<br />
} <br />
<br />
}<br />
<br />
function showI()<br />
{<br />
<br />
if(j<100)<br />
{<br />
document.getElementById("img1").style.filter ="alpha(opacity="+j+")";<br />
j=10 + j;<br />
<br />
}<br />
else<br />
{<br />
document.getElementById("img1").style.filter ="alpha(opacity="+100+")";<br />
window.clearInterval(sI);<br />
<br />
}<br />
}<br />
<br />
</script><br />
</head><br />
<body><br />
<center><br />
<br/><br />
<br/><br />
<div id="div1"><br />
<img src="images/1.jpg" class="imgf" id="img1"/><br />
</div> <br />
</center><br />
</body><br />
</html><br />
it gives unwanted flicks on IE coz clearInterval did not work.....
|
|
|
|
|
Try using JQuery[^]. Cross platform and much less to write.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I don't know anything about jquery......it's will take long to understand and implement that coz it's new technology for me...so plz can u help me with this in Javascript code....
Thnx...
|
|
|
|
|
Mmmm... did you even try to click on the link Mark provided ? Because I'm not sure anyone is gonna help you here if, on your side, you're not able to give yourself a little effort.
|
|
|
|
|
<script src=jquery-1.4.2.min.js />
$("#img1).fadeIn();
This is too difficult for you?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I used JQuery and JQueryUI in my last article, it was the first time i had even looked at JQuery, let alone actual go an implement it.
You should find it no problem at all, the basics are surprisingly simple.
|
|
|
|
|
EDIT:
OOps, sorry Mark, replied to the wrong message!
ignore it.
|
|
|
|
|
When you use setInterval you are supposed to set it to a variable, which becomes its ID, in effect - eg
instead of just writing
setInterval("showN()",40);
as you have, you should write
var IntervalID = setInterval("showN()",40);
Then, later when you want to clear it, you must refer to that ID:
clearInterval(intervalID);
Edit: screw jQuery. Never found a use for it yet. DIY, always.
|
|
|
|