It is opening a new tab because it is executing the default action.
href="" equals the current URL, so it's opening that in a blank
window. Return false to avoid that.

$("a").click(function(){
    parent.location='upload.php?item=2';
    return false;
});

On Nov 20, 12:33 pm, edzah <[EMAIL PROTECTED]> wrote:
> Ok I've got this working, dunno if it was a syntax issue or what, but
> I did this:
>
> $("a").click(function() { parent.location='upload.php?item=2' });
>
> Although it behaves slightly strange. It opens the upload.php?item=2
> as a tab in FF, then opens the original page in a new tab and focuses
> on that. My <a> tag:
>
> <div><a href="" id="upload" target="_blank">upload</a> </div>
>
> I would still be interested in any comments regarding this method of
> uploading to a mysql dbase...
>
> thanks
>
> On Nov 20, 2:16 pm, edzah <[EMAIL PROTECTED]> wrote:
>
> > Should really do more reading but at the moment I haven't got the time
> > so I would appreciate any help I can get.
>
> > Overview:
>
> > I have a form (with the default submit turned off) that takes user
> > input and adds each form entry into a table below the form. The user
> > will then review the list of entries to be uploaded and then clicks an
> > upload button to upload it to the mysql dbase.
>
> > My problem:
>
> > The button I am using is an anchor tag, with the attribute onclick. I
> > want to take all the entries in the table and then create a php query
> > string so that when the anchor tag is click it will pass this data to
> > a php file which will do the mysql insert.
>
> > <a id="upload" onclick="parent.location='upload.php?item='"
> > target="_blank">upload</a>
>
> > But I cannot seem to access/update the onlick attribute.
> > I hoped this would work:
>
> > $("a").attr({ onclick : "parent.location='upload.php?item=2'" });

Reply via email to