Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript function problem

Options
  • 03-08-2005 12:20pm
    #1
    Registered Users Posts: 3,012 ✭✭✭


    Ok,

    not much of a JavaScript man, but have to redesign a search tool on a website, that's done in it.
    I have it all worked out, and working except for one function, that I need to flip through pages of results.

    Here's the code:
     function function_NextPage(place, type, input)
    {
    	var left_table = "searchresultLeft.html?place="+place+"&choice="+type+"&content="+input;
     	parent.frame_dataLeft.location.href = left_table;
    }
    
    ................................................
    
       document.write("<form><input type='button' value='Next Page' onClick='function_NextPage('00"+i+"','name','"+Input+"')'></form>");
    

    I dont need to be told the problems with frames, or a language that can do it better than JS, cause I dont have a choice as to how it's done.

    At the moment the button does nothing, but I do know that the values of i and Input are correct.

    If anyone could tell me why it doesn't work, I'd really appretiate it.

    Cheers.


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    The problem seems to lie with your quotation marks as far as I can see. When you're using the onClick value for example, your can't mix your quotes. SO you need to use one type of quote for the value declaration (e.g. onClick="..."), and another type of quote within the Javascript inside these quotes. When the browser reads a second double (or single) quote inside the javascript, it treats that as the end of the onClick value declaration, so you get an error.
    Try
    document.write("<form><input type='button' value='Next Page' onClick=\"function_NextPage('00"+i+"','name','"+Input+"')\"></form>");
    Let me know if it works.


  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    Worked a treat.

    Cheers Dude.


Advertisement