Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Please help me to fix this peice of javascript code

    PHP Code:
    function CustomError(AL B){
    if(
    AL){
    }
    else {
    alert("A required argument didn't been passed to the programme(First arguments)")
    }
    if($(
    document)){
    var 
    id2 "AlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlertAlert";
    var 
    id1 "Big ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig Error";
    var 
    id3 "Side BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide BarSide Bar";
    var 
    idB "XBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTONXBUTTON";
    var 
    div1 document.createElement("div");
    div1.style.background "Green";
    div1.setAttribute("id" id1)
    var 
    div document.createElement("div");
    div.style.background "Green";
    div.setAttribute"id"id2 );
    div.innerHTML += '<h1>';
    switch(
    AL){
    case 
    1:
            
    div.innerHTML += "A minor Error has ocuured. This can be due to missing line of code or error in code...etc";
            if(
    B) {
            
    div.innerHTML += B
            
    }
            
    div.innerHTML += "</h1>";
            
    div.innerHTML += "<br />";
            break;
    case 
    "1":
            
    div.innerHTML += "A minor Error has ocuured. This can be due to missing line of code or erroe in code...etc";
            if(
    B) {
            
    div.innerHTML += B
            
    }
            
    div.innerHTML += "</h1>";
            
    div.innerHTML += "<br />";
            break;
    case 
    :
            
    div.innerHTML += "A hard Error has ocuured. This can be due to missing library's files...etc";
            if(
    B) {
            
    div.innerHTML += B
            
    }
            
    div.innerHTML += "</h1>";
            
    div.innerHTML += "<br />";
            break;
    case 
    "3":
            
    div.innerHTML += "A hard Error has ocuured. This can be due to missing library's files...etc";
            if(
    B) {
            
    div.innerHTML += B
            
    }
            
    div.innerHTML += "</h1>";
            
    div.innerHTML += "<br />";
            break;
    case 
    4:
            
    div.innerHTML += "A Fatal Error has ocuured. This can be due to missing extension files or databases...etc";
            if(
    B) {
            
    div.innerHTML += B
            
    }
            
    div.innerHTML += "</h1>";
            
    div.innerHTML += "<br />";
            break;
    case 
    "4":
            
    div.innerHTML += "A Fatal Error has ocuured. This can be due to missing extension files or databases...etc";
            if(
    B) {
            
    div.innerHTML += B
            
    }
            
    div.innerHTML += "</h1>";
            
    div.innerHTML += "<br />";
            break;
    case 
    2:
            
    div.innerHTML += "An Error has ocuured. This can be due to missing minor files...etc";
            if(
    B) {
            
    div.innerHTML += B
            
    }
            
    div.innerHTML += "</h1>";
            
    div.innerHTML += "<br />";
            break;
    case 
    "2":
            
    div.innerHTML += "An Error has ocuured. This can be due to missing minor files...etc";
            if(
    B) {
            
    div.innerHTML += B
            
    }
            
    div.innerHTML += "</h1>";
            
    div.innerHTML += "<br />";
            break;
    }
    div.innerHTML += "Please let the owner know about this probleme for better performance in the future<br />";
    div.innerHTML += "Sorry for the inconvenience"
    div1.appendChild(div);
    div1.width"400px";
    div1.height "500px";
    div1.position "absolute";
    div1.top "200px";
    div1.left "-400px";
    var 
    el =document.createElement("div");
    div1.appendChild(el);
    el.style.background "red";
    el.style.position div1.style.position;
    el.style.top div1.style.top;
    el.style.left div1.style.left;
    el.height "20px";
    el.innerHTML += "ErrorMessage-By EasyJavaScriptLibrary";
    var 
    document.createElement("Button");
    s.setAttribute("id" idB);
    s.setAttribute("type" "Button");
    s.setAttribute("onClick" "DEM()");
    var 
    document.createTextNode("X");
    s.appendChild(h);
    el.appendChild(s);
    s.style.width "10px";
    s.style.height "10px";
    s.style.positon div1.style.position;
    s.style.top "0px";
    s.style.left div1.style.left div1.style.width s.style.Width;
    $( 
    "#" id1).ready(function(){
    $(
    "#" id1).animate({
    top'200px' ,
    left '300px'
    } , 5000)
    })
    window.ABM 1;
    }
    else {
    alert("Unable to connect to the internet or JQuery is unvailable for some reasons");
    window.ABM 0;
    }
    }
    function 
    DEM() {
    switch(
    ABM) {
    case 
    0:
    alert("Their are not anu currentABM Working");
    break;
    case 
    1:
    var 
    id "Big ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig ErrorBig Error";
    Erase(id);
    break;
    }
     

    I've called this function this way:
    \javascript code:
    PHP Code:
    var ErorManager 1;
    switch(
    ErorManager){
    case 
    1:
    CustomError(1);
    break;
    case 
    2:
    CustomError(2);
    break;
    case 
    3:
    CustomError(3);
    break;
    case 
    4:
    CustomError(4);
    break;

    But it dosn't work i see the inspect elemnt in my googleChrome Browser no errors was found.
    This is getting my mind lost.
    Please help.
    P.S.Jquery is used sidly.
    Explanation:
    I've Created a green div with a specefied (id) this will be a container
    Then i Created another inside the first i writed stuufs depending on user alert level input.
    Then i added what line the user want to add(it is b)
    then i continue writting after the switch
    then i created a div that will be the titile of the Error Message
    then i created an X button to exit the Error Message(Much like a popup)
    I styled The div and el as widthh and height div1 the big momy
    I put it -500px to the left and 200px to the rop
    I smoothly moved it to Left:300px and top:200px using jquery
    A lot of if() statement is putten to avoid maximale error and for reterning the best error report

    p.s. i tried it in chrome and it didn' t work out the Animation
    So what to do
    Last edited by VIPStephan; 03-22-2013 at 04:38 PM. Reason: added code BB tags

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,073
    Thanks
    38
    Thanked 498 Times in 492 Posts

    Question

    Why such long id values?

    Note: Spaces not allowed in id values.

    BTW: You should enclose you program between [ code] and [ /code] tags (without the spaces)
    to retain the formatting of your original script.

  • Users who have thanked jmrker for this post:

    Jamilh123 (03-22-2013)

  • #3
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I put a long id in my library for avoiding conflict ids
    Ex:if I put an id of bigmomy and a div in html is called also bigmomy here is the problems.
    I think that is the problems space with id
    thanks for help
    I will see if it will work

  • #4
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,073
    Thanks
    38
    Thanked 498 Times in 492 Posts

    Arrow

    Quote Originally Posted by Jamilh123 View Post
    I put a long id in my library for avoiding conflict ids
    Ex:if I put an id of bigmomy and a div in html is called also bigmomy here is the problems.
    I think that is the problems space with id
    thanks for help
    I will see if it will work
    Just use adjectives as in id="bigmomy" and then id="bigmomyDiv"
    The problem would not be long id values, but unique id values.

    Yours are just too long to not get into typo errors!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •