Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

indexof in jsp

 
ketandba shah
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am beginer in jsp & java script.
here is my code.

*******
<SCRIPT LANGUAGE="JavaScript">
function DoInit(){
document.screen.Irp__Unitnbr.selectedIndex = -1;
<% if ( screenbean.getFldVal("Irp__Unitnbr").trim().length() > 0 ) {%>
var z = 0;
for (z=0; z < document.screen.Irp__Unitnbr.options.length; z++) {

int index1 = document.screen.Irp__Unitnbr.options[z].text.indexOf("*");

if (document.screen.Irp__Unitnbr.options[z].text.substring(0,index1) == '<%=screenbean.getFldVal("Irp__Unitnbr").trim()%>' ) {
document.screen.Irp__Unitnbr.selectedIndex = z;
}
}
<% } %>



********

i want
int index1 = document.screen.Irp__Unitnbr.options[z].text.indexOf("*");

how i get index1? after that i have to implement substr(0,index1)

pl. reply

Thanks in advanced
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64858
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how i get index1?


I have no idea what you mean by this.
 
ketandba shah
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i.e how to get from


document.screen.Irp__Unitnbr.options[z].text.indexOf("*")


e.g
document.screen.Irp__Unitnbr.options[z].text = '234567*afasfALAFD-HASA2MJA'

MY QUESTION IS IMPLEMENT indexOf on
document.screen.Irp__Unitnbr.options[z].text

document.screen.Irp__Unitnbr.options[z].text.indexOf("*") returns 6.
and then i have to implement substring(0,6)


Pl. reply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic