ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

A neat little javascript....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A neat little javascript....

    There isn't a place on here specifically for javascript so I am going to post it here in the HTTP section...that's the closest to it...

    This little script will create dynamically named windows based off of a cell that was clicked by the user in a table. The window then opens up with the corner where they clicked. Its pretty neat. I'm proud of what I've achieved

    PHP Code:
    function LineDetail(mylinkwindowname)
    {
    if (! 
    window.focus)return true;
    var 
    href;
    if (
    typeof(mylink) == 'string')
       
    href=mylink;
    else
       
    href=mylink.href;
       
    var 
    posy event.clientY 100;
    var 
    posx event.clientX;  

    window.open(hrefwindowname'width=660,height=200,left='+posx+',top='+posy+',scrollbars=yes');

    return 
    false;


    here is the html to make it work....it has some java mixed in it, its from my jsp page...i know i'm going to get yelled at...its not MVC

    PHP Code:
    if((intline 2) == 1)
                 {
                     
    eclrs.append("<td class=\"link\" onmouseover=\"this.style.background=\'blue\'; this.style.color=\'white\'; this.style.cursor=\'pointer\'\" onmouseout=\"this.style.background='white'; this.style.color=\'blue\'\" onclick=\"return LineDetail('Line.jsp?lnum=");
                     
    eclrs.append(line);
                     
    eclrs.append("&itm=");
                     
    eclrs.append(item);
                     
    eclrs.append("&div=");
                     
    eclrs.append(division);
                     
    eclrs.append("', 'line");
                     
    eclrs.append(line);
                     
    eclrs.append("')\">");
                     
    eclrs.append(line);
                     
    eclrs.append("</td>\n");
                     
    out.print(eclrs.toString());
                 }
                 else
                 {
                     
    eclrs.append("<td class=\"link\" onmouseover=\"this.style.background=\'blue\'; this.style.color=\'#EEE\'; this.style.cursor=\'pointer\'\" onmouseout=\"this.style.background='#EEE'; this.style.color=\'blue\'\" onclick=\"return LineDetail('Line.jsp?lnum=");
                     
    eclrs.append(line);
                     
    eclrs.append("&itm=");
                     
    eclrs.append(item);
                     
    eclrs.append("&div=");
                     
    eclrs.append(division);
                     
    eclrs.append("', 'line");
                     
    eclrs.append(line);
                     
    eclrs.append("')\">");
                     
    eclrs.append(line);
                     
    eclrs.append("</td>\n");
                     
    out.print(eclrs.toString());
                 }
    %>
                <
    td><%= item %></td>
                <
    td><h4 class='entered'>ENTERED</h4></td>
                <
    td><%= ecldatetime %></td>
                <
    td class='dollars'><%= quantity %></td>
                <
    td class='dollars'><%= format.format(value*quantity) %></td>
                <
    td><%= user %></td>
                </
    tr

    I have some other mouseover scripts too. I wish it wasn't an internal app so I could post a screen shot. The whole sensitive data thingy...
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com
Working...
X