|
javascript __doPostBack function - it wont work : (
|
View this Thread in Original format
| UglyDave |
Hi guys - wrong forum, yeah, but anything goes in here really..
k, i'm using the examt same piece of code on a different page on my site and it works fine.. but when i transferred it to another page i get an error saying "Microsoft JScript runtime error: Object expected"
here's the code:
code:
function DoPostBack()
{
__doPostBack('_ctl0_ContentPlaceHolder1_davemc', '');
document.getElementById('_ctl0_ContentPlaceHolder1_davemc').value = '';
}
purpose of code: open a new window containing a list of user uploaded files - let the user select the file, then transfer their selection back to the 'opener' window and add it to a .net control on the page.
any suggestions?
Thanks,
David |
|
|
| Orbax |
are the object fields providing the information named the same? When you say you just transferred the code isnt it expecting the same names such as a text object called Uname or something...
if its a function, the only thing that seems like it would change would be those names?
I do different coding so I dunno what im talking about :p
edit:
so like if a function is opening a page with the username = the object of UserName and on the new page its usersname it would break it. |
|
|
| UglyDave |
hmm.. think we might be thinking about different things here..
basically, borwser A, opens a new window - browser B.. The user selects an image file from B, then this code is executed (these links are all dynamically generated whent he page loads):
code:
< h ref="" onClick=javascr1pt:sendValue('ht tp://ww w.buncrana.com/Clients/Uploads/2.jpg');>ht tp://www.buncrana.com/Clients/Uploads/2.jpg >
-------------------
// the JS code for the sendValue() function:
function sendValue(fileName)
{
window.opener.document.getElementById('_ctl0_ContentPlaceHolder1_davemc').value = fileName;
window.opener.DoPostBack();
window.close();
}
|
|
|
| Orbax |
| ermmm form method matter? sorry dude I dont program in web OOP lololol |
|
|
| UglyDave |
meh, it was a longshot.. askin a javascript question in a trance forum :)
cheers anyways dude! |
|
|
| Orbax |
lol not that long of a shot. there are a lot of web junkies in here and they just arent posting.
Its hard to understand your full issue though. A new webpage may mean a new server, etc. Code doesnt magically break so the postback method is either referencing something that no longer exists or the server is translating it incorrectly and has the wrong version of java, ASP, or .NET.
I dont know if you made a testbed on your laptop and are now trying to copy it onto a different page on your own setup or translate it into your corporate environment.
There are a lot of variables depending on the scope of the "new page"
but...I just know basic oop, and how code typically functions. besides that stuff, I wish I knew more!
good luck! |
|
|
| UglyDave |
ya, it's a fairly hefty big website! been working on it for months..
still running it on my laptop.... haven't even tried it on the server yet, so fingers crossed! i think i'm in for a busy week!!
D |
|
|
| Orbax |
hehe. I was just seeing if by asking a "I dont know about java" kind of question youd remember...wish I knew more places to think of where it could be wrong, but if its all on the same server and using the same pages as the other page...
I mean if you copy and paste that other page, it should still work, so its gotta be something on the transcribed page.
/javanoob |
|
|
|
|