asp.net - Issue on Stop/Prevent Tab Changing on Javascript -


I am using javascript on an asp.net web application and I have a button that displays an image on the page What is working on the click, but it also changes from tab element tab 2 to tab 0 index too!

Here is the JavaScript and asp code that I have:

  & lt; Script type = "text / javascript" & gt; Var baseUrl = document.URL.split ("webform /") [0]; Function openImageDoc (filePath, titleName) {var newUrl = baseUrl + filePath; Window.open (newUrl, header name, 'width = 900, height = 800, scrollbar = 1'); } & Lt; / Script & gt; & Lt; ASP: Button ID = "RiskMapDisplay" runat = "server" style = "margin-left: 734px" OnClientClick = "openImageDoc ('Images / Riskmap.Jpg', 'RiskMap')" Text = "Risk Matrix" Reason validity = " False "tabinedx =" 3 "/>  

Can you please tell me how can I stop it or because of this what could be it? Thanks

Use the following code:

  & lt; Script type = "text / javascript" & gt; Var baseUrl = document.URL.split ("webform /") [0]; Function openImageDoc (filePath, titleName) {var newUrl = baseUrl + filePath; Window.open (newUrl, header name, 'width = 900, height = 800, scrollbar = 1'); return false; }  

  & lt; Asp: Button ID = "RiskMapDisplay" runat = "server" style = "margin-left: 734px" OnClientClick = "Return OpenImageDoc ('Images / Riskmap. JPG', 'Risk Map')" Text = "Risk Matrix" Reason Validation = "Incorrect" tabindex = "3" />  

Add return false; prevents the button from doing its normal work, in which case there will be a postback on the server.

If this works, then mark it as a reply.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -