This is my HTML code:
<form name="edit" method="post">
<div><select name="Edi" id ="Edi" >
<option selected="selected">Select</option>
<option value="1.php?table= Shift">Shift</option>
<option value="1.php?table= Start">Start</option>
<option value="2.php?table= Report">Report</option>
</select>
<input onclick="return Edit();" type="submit" value="Edit"/></div>
</form>
Here is the Javascript code:
function Edit(){
if(document.forms['edit'].Edi.value == "Select")
{
alert("Please Select Edit Field");
return false;
}
else
{
window.open(Edi.options[Edi.selectedIndex].value);
return true;
}
}
This works, great but it opens the link once Edit button is pressed on a new page. I looked online and for it to do that you have to use "_self". So i changed that line to:
window.open(Edi.options[Edi.selectedIndex].value,"_self");
But when i click the button it just refreshes the current page. Is there something wrong in my code?
I tried this and it doesnt work as well.
window.location.href = Edi.options[Edi.selectedIndex].value;
Is this possible to open the link on the same tab?